public async Task <IActionResult> PutTbMRiskReminder([FromRoute] short id, [FromBody] TbMRiskReminder tbMRiskReminder) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Entry(tbMRiskReminder).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TbMRiskReminderExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostTbMRiskReminder([FromBody] TbMRiskReminder tbMRiskReminder) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.TbMRiskReminder.Add(tbMRiskReminder); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TbMRiskReminderExists(tbMRiskReminder.YearActive)) { return(new StatusCodeResult(StatusCodes.Status409Conflict)); } else { throw; } } return(CreatedAtAction("GetTbMRiskReminder", new { id = tbMRiskReminder.YearActive }, tbMRiskReminder)); }
public async Task <IActionResult> DeleteTbMRiskReminder([FromBody] TbMRiskReminder controlDelete) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var tbMRiskReminder = await _context.TbMRiskReminder.SingleOrDefaultAsync(e => e.YearActive == controlDelete.YearActive && e.TypeReminder == controlDelete.TypeReminder && e.CounterNo == controlDelete.CounterNo); if (tbMRiskReminder == null) { return(NotFound()); } _context.TbMRiskReminder.Remove(tbMRiskReminder); await _context.SaveChangesAsync(); return(Ok(tbMRiskReminder)); }