public ActionResult SaveFirm(FirmViewModel model) { if (ModelState.IsValid) { try { if (model.FirmId != 0) { model.ModifiedDate = DateTime.Now; try { bool _result = _FirmService.UpdateFirm(model); if (_result == true) { TempData["resultMessage"] = "Firm Information Updated Successfully"; } return(RedirectToAction("Dashboard")); } catch (Exception ex) { throw; } } else { model.CreatedDate = DateTime.Now; try { bool _result = _FirmService.AddFirm(model); if (_result == true) { TempData["resultMessage"] = "Firm Added Successfully"; } return(RedirectToAction("Dashboard")); } catch (Exception ex) { throw; } } //return View("AddClient"); } catch (Exception ex) { return(View("AddClient")); } } return(View("Dashboard")); }
public IActionResult UpdateFirm(UpdateFirmDTO model) { var firm = _firmService.GetFirmById(model.Id); if (string.IsNullOrEmpty(firm.Id)) { return(OK(StatusCodeType.FIRM_NOTFOUND, StatusMessage.FIRM_NOTFOUND, false)); } var response = _firmService.UpdateFirm(model); if (response == null) { return(OK(StatusCodeType.HAS_EXCEPTION, StatusMessage.HAS_EXCEPTION, response)); } return(OK(StatusCodeType.SUCCESS, StatusMessage.SUCCESS, response)); }