public async Task <IActionResult> PostMstVersion([FromBody] MstVersion mstVersion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.MstVersion.Add(mstVersion); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (MstVersionExists(mstVersion.VersionId)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetMstVersion", new { id = mstVersion.VersionId }, mstVersion)); }
public async Task <IActionResult> PutMstVersion([FromRoute] int id, [FromBody] MstVersion mstVersion) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != mstVersion.VersionId) { return(BadRequest()); } _context.Entry(mstVersion).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MstVersionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }