public bool UpdateOrderItems(OrderItemsEdit model) { using (var ctx = new ApplicationDbContext()) { var entity = ctx .OrderItems .Single(e => e.OrderItemId == model.OrderItemId); //entity.GameId = model.GameId; entity.Quantity = model.Quantity; return(ctx.SaveChanges() == 1); } }
public IHttpActionResult Put(OrderItemsEdit orderItems) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateOrderItemsService(); if (!service.UpdateOrderItems(orderItems)) { return(InternalServerError()); } return(Ok()); }