public static void EditAccess(AccessRoleCategory accessNew) { IRepository repository = new Repository(); try { repository.UpdateAccess(accessNew); } catch { } }
public void AddToBase() { IRepository repository = new Repository(); ID = repository.CreateCatalogCategories(this); if (ID != 0) { WorkLinqToSql.AspNetRole role = repository.GetUserRole(Access.ADMINID); if (role != null) { AccessRoleCategory access = new AccessRoleCategory(1, ID, true, true, true); repository.CreateAccess(access); } } }
public bool RemoveAccess(AccessRoleCategory accessModel) { try { CatalogDatabaseDataContext context = new WorkLinqToSql.CatalogDatabaseDataContext(); WorkLinqToSql.AccessCatalogCategories access = (from acc in context.AccessCatalogCategories where (acc.CategoryID == accessModel.CategoryID) && (acc.RoleID == accessModel.RoleID) select acc).Single(); context.AccessCatalogCategories.DeleteOnSubmit(access); context.AccessCatalogCategories.Context.SubmitChanges(); } catch { return(false); } return(true); }
public bool UpdateAccess(AccessRoleCategory accessModel) { try { CatalogDatabaseDataContext context = new WorkLinqToSql.CatalogDatabaseDataContext(); WorkLinqToSql.AccessCatalogCategories access = (from acc in context.AccessCatalogCategories where (acc.CategoryID == accessModel.CategoryID) && (acc.RoleID == accessModel.RoleID) select acc).Single(); access.R = accessModel.CanRead; access.W = accessModel.CanWrite; access.F = accessModel.CanDownloadFile; context.AccessCatalogCategories.Context.SubmitChanges(); } catch { return(false); } return(true); }
public bool CreateAccess(AccessRoleCategory accessModel) { CatalogDatabaseDataContext context = new CatalogDatabaseDataContext(); try { WorkLinqToSql.AccessCatalogCategories access = new AccessCatalogCategories(); access.F = accessModel.CanDownloadFile; access.R = accessModel.CanRead; access.W = accessModel.CanWrite; access.RoleID = accessModel.RoleID; access.CategoryID = accessModel.CategoryID; context.AccessCatalogCategories.InsertOnSubmit(access); context.AccessCatalogCategories.Context.SubmitChanges(); } catch { return(false); } return(true); }
public CatalogAppMVC.Models.AccessRoleCategory ToAccess(WorkLinqToSql.AccessCatalogCategories accessFromBase) { CatalogAppMVC.Models.AccessRoleCategory access = new AccessRoleCategory(accessFromBase.RoleID, accessFromBase.CategoryID, accessFromBase.R, accessFromBase.W, accessFromBase.F); return(access); }