public object UpdateStatus(int id, UpdateStatusReq status) { using (var tran = context.Database.BeginTransaction()) { try { var result = context.Orders.FirstOrDefault(value => value.OrderID == id); if (result != null) { result.Status = status.Status; context.Orders.Update(result); context.SaveChanges(); tran.Commit(); return(result); } else { return("Unable to update: not found ID."); } } catch (Exception ex) { tran.Rollback(); return(ex.StackTrace); } } }
public IActionResult UpdateStatus(int id, UpdateStatusReq status) { var result = orderSvc.UpdateStatus(id, status); return(Ok(result)); }
public object UpdateStatus(int id, UpdateStatusReq status) { return(orderRep.UpdateStatus(id, status)); }