public async Task <IActionResult> PutSchLeaveDetails([FromRoute] int id, [FromBody] SchLeaveDetails schLeaveDetails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != schLeaveDetails.AutoId) { return(BadRequest()); } _context.Entry(schLeaveDetails).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SchLeaveDetailsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostSchLeaveDetails([FromBody] SchLeaveDetails schLeaveDetails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.SchLeaveDetails.Add(schLeaveDetails); await _context.SaveChangesAsync(); return(CreatedAtAction("GetSchLeaveDetails", new { id = schLeaveDetails.AutoId }, schLeaveDetails)); }