コード例 #1
0
        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 }));
            }
        }
コード例 #2
0
        public IActionResult GetById(int id)
        {
            var result = _insuranceManager.GetById(id);

            return(Ok(result));
        }