public ActionResult Kurumlar(Kurum model) { Guid recordId = Guid.Empty; CrmRepository crmDB = RepositoryManager.GetRepository <CrmRepository>(); #region Ortak Set Edilecek Değerler SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; #endregion ModelState.Remove("is_active"); if (model.FromDeleteButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { crmDB.DeleteKurum(model, Guid.Parse(model.RecordId)); return(RedirectToAction("ListPage", "General", new { MenuId = Dcm.Source.GlobalHelper.Encrypt(model.MenuId) })); } } else { if (ModelState.IsValid) { if (GlobalHelper.IsGuid(model.RecordId)) { recordId = Guid.Parse(model.RecordId); try { model = crmDB.UpdateKurum(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { try { crm_kurumlar kurum = new crm_kurumlar(); crmDB.AddKurum(kurum, model); model.RecordId = kurum.kurum_id.ToString(); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } else { ViewBag.Success = false; } } return(View(model)); }