public async Task <IActionResult> PostTbRSendmail([FromBody] TbRSendmail tbRSendmail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TbRSendmail.Add(tbRSendmail); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TbRSendmailExists(tbRSendmail.YearActive)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetTbRSendmail", new { id = tbRSendmail.YearActive }, tbRSendmail)); }
public async Task <IActionResult> PutTbRSendmail([FromRoute] short id, [FromBody] TbRSendmail tbRSendmail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Entry(tbRSendmail).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TbRSendmailExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }