public async Task <IHttpActionResult> UpdateGroceryList([FromUri] int id, [FromBody] GroceryEdit model) { GroceryService service = CreateGroceryService(); if (await service.UpdateGroceryListById(id, model) == false) { return(InternalServerError()); } return(Ok()); }
//Update grocery by id public async Task <bool> UpdateGroceryListById([FromUri] int id, [FromBody] GroceryEdit model) { var entity = _context .GroceryLists .Single(e => e.GroceryListId == id && e.OwnerId == _userId); entity.Name = model.Name; return(await _context.SaveChangesAsync() == 1); }