public async Task <IActionResult> PutDeasisHistory([FromRoute] int id, [FromBody] DeasisHistory deasisHistory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != deasisHistory.DeasisHistoryId) { return(BadRequest()); } try { _repo.Update(deasisHistory); var save = await _repo.SaveAsync(deasisHistory); } catch (DbUpdateConcurrencyException) { if (!DeasisExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult> PostDeasisHistories([FromBody] DeasisHistory deasisHistory) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _repo.Add(deasisHistory); var save = await _repo.SaveAsync(deasisHistory); return(CreatedAtAction("GetDeasisHistories", new { id = deasisHistory.DeasisHistoryId }, deasisHistory)); }