public ActionResult Approve(long ID) { try { string approval = _approvalAppService.GetById(ID, true); if (string.IsNullOrEmpty(approval)) { return(Json(new { Status = "False" }, JsonRequestBehavior.AllowGet)); } else { var approvalModel = JsonConvert.DeserializeObject <ApprovalModel>(approval); approvalModel.approve = true; string data = JsonHelper <ApprovalModel> .Serialize(approvalModel); _approvalAppService.Update(data); string customer = _customerAppService.FindByNoTracking("customer_code", approvalModel.customer_code); var customerModel = JsonConvert.DeserializeObject <List <CustomerModel> >(customer).FirstOrDefault(); customerModel.teritorry = approvalModel.territory_new; data = JsonHelper <CustomerModel> .Serialize(customerModel); _customerAppService.Update(data); } return(Json(new { Status = "True" }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { Status = "False" }, JsonRequestBehavior.AllowGet)); } }
public IActionResult Put([FromBody] ApprovalDTO approvalDTO) { if (!ModelState.IsValid) { NotifyModelStateErrors(); return(Response()); } _approvalAppService.Update(approvalDTO); return(Response(approvalDTO)); }