public async Task <ActionResult <BillingCycle> > UpdateCyclo([FromBody] BillingCycle cycle) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (cycle == null) { return(BadRequest()); } _context.Entry(cycle).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CycleExists(cycle.CycleID)) { return(NotFound()); } else { throw; } } return(Ok()); }
public async Task <ActionResult> UpdateUser([FromBody] User user) { if (user == null) { return(BadRequest()); } try { _context.Entry(user).State = EntityState.Modified; await _context.SaveChangesAsync(); return(Ok(user)); } catch (DbUpdateException e) { return(Conflict(e)); } }