public async Task <IActionResult> PutTimeShedule([FromRoute] int id, [FromBody] TimeShedule timeShedule) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != timeShedule.SheduleId) { return(BadRequest()); } _context.Entry(timeShedule).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TimeSheduleExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostTimeShedule([FromBody] TimeShedule timeShedule) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TimeShedule.Add(timeShedule); await _context.SaveChangesAsync(); return(CreatedAtAction("GetTimeShedule", new { id = timeShedule.SheduleId }, timeShedule)); }