public string CreateDashboard(CreateDashboardDto dbDto, User user) { Dashboard dashEnt = new Dashboard { DashBoardGUID = CreateGUID.GetGUID(), Name = dbDto.Name, Author = user }; _dashboardRepository.Add(dashEnt);//add után már benne van a Id érték _userDashRelRepository.Add(new UserDashboardRel { User = user, AuthoryLayer = (int)DashboardUserPermissions.CanModify, Dashboard = dashEnt }); foreach (var rel in dbDto.Reports) { var report = _reportRepository.Get(rel.ReportGUID); if (report == null) { continue; } _reportDashboardRel.Add(new ReportDashboardRel { Dashboard = dashEnt, Report = report, Position = rel.Position }); } return(dashEnt.DashBoardGUID); }
public bool Create(CreateDashboardUserDto DashboardUserRel) { if (!IsExistUserAndDashboard(out User user, out Dashboard Dashboard, DashboardUserRel.UserGUID, DashboardUserRel.DashboardGUID)) { return(false); } if (IsExistRel(user.Id, Dashboard.Id) != null)//létezik a jogosultság { return(false); } _userDashboardRelRepository.Add(new UserDashboardRel { Dashboard = Dashboard, User = user, AuthoryLayer = DashboardUserRel.Permission }); return(true); }