public void RemoveModuleToOrganization(string menuName) { Guid menuGuid = this._context.MenuActions.Where(i => i.Name_TR == menuName).Select(i => i.Id).FirstOrDefault(); RelOrganizationMenuAction isAlreadyExist = this._context.RelOrganizationMenuActions .Where(i => i.MenuActionId == menuGuid & i.OrganizationId == this.organization.Id) .FirstOrDefault(); if (isAlreadyExist != null) { this._context.RelOrganizationMenuActions.Remove(isAlreadyExist); this._context.SaveChanges(); } }
//Modul satin alinma islemleri public void AddAllModuleToOrganization() { List <Guid> menuActions = this._context.MenuActions.Select(i => i.Id).ToList(); foreach (var item in menuActions) { RelOrganizationMenuAction relOrganizationMenuAction = new RelOrganizationMenuAction(); relOrganizationMenuAction.MenuActionId = item; relOrganizationMenuAction.OrganizationId = this.organization.Id; relOrganizationMenuAction.IsPassive = null; this._context.RelOrganizationMenuActions.Add(relOrganizationMenuAction); } this._context.SaveChanges(); }
public void AddModuleToOrganization(string menuName) { Guid menuGuid = this._context.MenuActions.Where(i => i.Name_TR == menuName).Select(i => i.Id).FirstOrDefault(); RelOrganizationMenuAction isAlreadyExist = this._context.RelOrganizationMenuActions .Where(i => i.MenuActionId == menuGuid & i.OrganizationId == this.organization.Id) .FirstOrDefault(); if (isAlreadyExist == null) { RelOrganizationMenuAction relOrganizationMenuAction = new RelOrganizationMenuAction(); relOrganizationMenuAction.MenuActionId = menuGuid; relOrganizationMenuAction.OrganizationId = this.organization.Id; relOrganizationMenuAction.IsPassive = null; this._context.RelOrganizationMenuActions.Add(relOrganizationMenuAction); this._context.SaveChanges(); } }