Exemplo n.º 1
0
        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"));
        }