public ActionResult Group(Group model) { Guid recordId = Guid.Empty; GenelRepository gnlDB = RepositoryManager.GetRepository <GenelRepository>(); SessionContext.Current.ActiveUser.MenuId = model.MenuId; ViewBag.Success = true; ModelState.Remove("is_active"); if (model.FromDeleteButton == "1") { if (GlobalHelper.IsGuid(model.RecordId)) { gnlDB.DeleteGroup(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 = gnlDB.UpdateGroup(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { try { gnl_user_groups group = new gnl_user_groups(); gnlDB.AddGroup(group, model); model.RecordId = group.group_id.ToString(); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } else { ViewBag.Success = false; } if (string.IsNullOrEmpty(model.ManagerName)) { model.ManagerId = null; } if (!string.IsNullOrEmpty(model.ManagerId) && GlobalHelper.IsGuid(model.ManagerId)) { gnl_users userManager = gnlDB.GetUser(Guid.Parse(model.ManagerId)); if (userManager != null) { model.ManagerName = userManager.name + " " + userManager.surname; } } } return(View(model)); }