public async Task <IActionResult> PostTbMLibrary([FromBody] TbMLibrary tbMLibrary) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TbMLibrary.Add(tbMLibrary); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TbMLibraryExists(tbMLibrary.Condition)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetTbMLibrary", new { id = tbMLibrary.Condition }, tbMLibrary)); }
public async Task <IActionResult> PutTbMLibrary([FromRoute] string id, [FromBody] TbMLibrary tbMLibrary) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tbMLibrary.Condition) { return(BadRequest()); } _context.Entry(tbMLibrary).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TbMLibraryExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }