public Role BindRole(Role model, Guid recordId) { gnl_roles role = new gnl_roles(); role = this.GetRole(recordId); model.role_name = role.role_name; model.role_explanation = role.role_explanation; model.is_active = role.is_active.Value; return(model); }
public void AddRole(gnl_roles role, Role model) { role.role_id = Guid.NewGuid(); role.role_name = model.role_name; role.role_explanation = model.role_explanation; role.is_active = model.is_active; role.is_deleted = false; db.gnl_roles.Add(role); this.Kaydet(); }
public Role UpdateRole(Role model, Guid recordId) { gnl_roles role = new gnl_roles(); role = this.GetRole(recordId); role.role_name = model.role_name; role.role_explanation = model.role_explanation; role.is_active = model.is_active; role.updated_at = DateTime.UtcNow; role.updated_by = SessionContext.Current.ActiveUser.UserUid; this.Kaydet(); return(model); }
public Role DeleteRole(Role model, Guid recordId) { gnl_roles role = new gnl_roles(); role = this.GetRole(recordId); role.is_deleted = true; role.is_active = false; role.deleted_at = DateTime.UtcNow; role.deleted_by = SessionContext.Current.ActiveUser.UserUid; this.Kaydet(); return(model); }
public ActionResult Role(Role 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.DeleteRole(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.UpdateRole(model, recordId); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } else { try { gnl_roles role = new gnl_roles(); gnlDB.AddRole(role, model); model.RecordId = role.role_id.ToString(); ViewBag.ResultMessage = Resources.GlobalResource.transaction_success; } catch (Exception exp) { ViewBag.Success = false; ModelState.AddModelError("Error", exp.Message); } } } else { ViewBag.Success = false; } Guid role_uid = Guid.Empty; if (Guid.TryParse(model.RecordId, out role_uid)) { List <gnl_role_related_users_v> listRoleRelatedUsers = gnlDB.GetRoleRelatedUsers(role_uid); model.roleRelatedUsers = listRoleRelatedUsers; } } return(View(model)); }