public JsonResult Edit(Insurance model) { try { if (!ModelState.IsValid) { return(Json(new { Result = "ERROR", Message = "Form is not valid! Please correct it and try again." })); } Insurance itemFound = InsuranceManager.GetById(model.kInsuranceId); if (itemFound == null) { return(Json(new { Result = "ERROR", Message = "Item Not Found" })); } model.dtDateAdd = itemFound.dtDateAdd; model.dtDateUpdate = DateTime.Now; InsuranceManager.Edit(model); return(Json(new { Result = "OK" })); } catch (Exception ex) { return(Json(new { Result = "ERROR", Message = ex.Message })); } }
public IActionResult GetById(int id) { var result = _insuranceManager.GetById(id); return(Ok(result)); }