Compare commits

..

No commits in common. "bf588c62edba31b43426127cccd6a728e43a01ef" and "b3b4562f21fbf6ca497f027661bfe4c511ec904a" have entirely different histories.

2 changed files with 1 additions and 19 deletions

View File

@ -84,13 +84,7 @@ namespace API.BusinessLogic
user.ShoppingList.Add(newItem);
}
bool succes = await _dbAccess.AddItemToShoppingList(user);
var updatedShoppingList = await _dbAccess.ReadShoppingList(userId);
if (succes) { return new OkObjectResult(updatedShoppingList.ShoppingList.Where(s => s.Name == listItemDTO.Name)); }
return new ConflictObjectResult(new { message = "Could not save to database" });
return await _dbAccess.UpdateShoppingList(user);
}
// Gets the shoppinglist and tries to find the item and when it does it checks/unchecks that item

View File

@ -34,17 +34,5 @@ namespace API.DBAccess
return new ConflictObjectResult(new { message = "Could not save to database" });
}
// Adds an item to the shoppinglist
public async Task<bool> AddItemToShoppingList(User user)
{
_context.Entry(user).State = EntityState.Modified;
bool saved = await _context.SaveChangesAsync() >= 1;
if (saved) { return true; }
return false;
}
}
}