private void ShowDependentOnRole(Role role) { if (!role.Permissions.Where(x => x.Title == "Edit User").Any()) { barSaveButton.Visibility = BarItemVisibility.Never; barSaveAndNewButton.Visibility = BarItemVisibility.Never; barNewButton.Visibility = BarItemVisibility.Never; } if (!role.Permissions.Where(x => x.Title == "Activate User").Any()) { userStateButton.Visibility = BarItemVisibility.Never; } if (!role.Permissions.Where(x => x.Title == "Deactivate User").Any()) { userStateButton.Visibility = BarItemVisibility.Never; } }
public void Save(Role currentRole) { RoleRepository.Update(currentRole); }
public void Create(Role currentRole) { RoleRepository.Create(currentRole); }
private void ShowDependentOnRole(Role role) { if (!role.Permissions.Any(x => x.Title == "Search Client by City")) clientCityTextEdit.Enabled = false; }
private void ShowDependentOnRole(Role role) { if (!role.Permissions.Any(x => x.Title == "Edit Client")) { clientBarSaveButton.Visibility = BarItemVisibility.Never; clientBarSaveAndNewButton.Visibility = BarItemVisibility.Never; clientBarNewButton.Visibility = BarItemVisibility.Never; buttonAddNewTelephoneEdit.Enabled = false; } if (!role.Permissions.Any(x => x.Title == "Activate Client")) { clientStateButton.Visibility = BarItemVisibility.Never; } if (!role.Permissions.Any(x => x.Title == "Deactivate Client")) { clientStateButton.Visibility = BarItemVisibility.Never; } if (!role.Permissions.Any(x => x.Title == "Comment Client")) { сlientNewCommentTextBox.Enabled = false; сlientAddCommentButton.Enabled = false; } }
private void ShowDependentOnRole(Role role) { if (!role.Permissions.Any(x => x.Title == "Add Category")) { addCategoryBarButton.Visibility = BarItemVisibility.Never; } if (!role.Permissions.Any(x => x.Title == "Edit Category")) { saveBarButton.Visibility = BarItemVisibility.Never; } if (!role.Permissions.Any(x => x.Title == "Comment Category")) { addNewCommentTextEdit.Enabled = false; addNewCommentButton.Enabled = false; } }
public void Update(Role entity) { dbContext.Entry(entity).State = System.Data.Entity.EntityState.Modified; dbContext.SaveChanges(); }
public void Delete(Role entity) { dbContext.Roles.Remove(entity); dbContext.SaveChanges(); }
public void Create(Role entity) { dbContext.Roles.Add(entity); dbContext.SaveChanges(); }
private void ShowDependentOnRole(Role role) { if (!role.Permissions.Any(x => x.Title == "Add User")) UserBarButton.Visibility = BarItemVisibility.Never; if (!role.Permissions.Any(x => x.Title == "Add Client")) ClientBarButton.Visibility = BarItemVisibility.Never; if (!role.Permissions.Any(x => x.Title == "Add Product")) ProductBarButton.Visibility = BarItemVisibility.Never; if (!role.Permissions.Any(x => x.Title == "Add Order")) OrderBarButton.Visibility = BarItemVisibility.Never; if (!role.Permissions.Any(x => x.Title == "Add Role")) RolesBarButton.Visibility = BarItemVisibility.Never; if (!role.Permissions.Any(x => x.Title == "Search User")) UsersListBarButton.Visibility = BarItemVisibility.Never; if (!role.Permissions.Any(x => x.Title == "Search Client")) ClientsListBarButton.Visibility = BarItemVisibility.Never; if (!role.Permissions.Any(x => x.Title == "Search Product")) ProductsListBarButton.Visibility = BarItemVisibility.Never; if (!role.Permissions.Any(x => x.Title == "Search Order")) OrdersListBarButton.Visibility = BarItemVisibility.Never; if (!role.Permissions.Any(x => x.Title == "Search Category")) ProductsListBarButton.Visibility = BarItemVisibility.Never; }
private void ShowDependentOnRole(Role role) { if (!role.Permissions.Any(x => x.Title == "Search Product by Category")) categoryLookUpEdit.Enabled = false; }
public void UsePermissionWithRoleID(int id) { _currentRole = _roles.First(x => x.Id == id);//.Clone() as Role; }
protected bool Equals(Role other) { return string.Equals(Title, other.Title) && Equals(Permissions, other.Permissions) && Id.Equals(other.Id); }
private void ShowDependentOnRole(Role role) { if (!role.Permissions.Any(x => x.Title == "Edit Product")) { barSaveButton.Visibility = BarItemVisibility.Never; barSaveAndNewButton.Visibility = BarItemVisibility.Never; barNewButton.Visibility = BarItemVisibility.Never; } if (!role.Permissions.Any(x => x.Title == "Activate Product")) { productStateButton.Visibility = BarItemVisibility.Never; } if (!role.Permissions.Any(x => x.Title == "Deactivate Product")) { productStateButton.Visibility = BarItemVisibility.Never; } if (!role.Permissions.Any(x => x.Title == "Comment Product")) { newCommentTextBox.Enabled = false; addCommentButton.Enabled = false; } }
private void ShowDependentOnRole(Role role) { if (!role.Permissions.Any(x => x.Title == "Edit Role")) { barSaveButton.Visibility = BarItemVisibility.Never; barAddButton.Visibility = BarItemVisibility.Never; } }