public List <DashboardDTO> GetDashboards(int userId) { try { var entities = _dbcontext.DB_Dashboards.Where(o => o.UserId == userId).Include(o => o.User).OrderBy(o => o.Name).ToList(); return(_dashboardMapper.GetDTOs(entities)); } catch (Exception e) { throw e; } }
public List <WidgetDTO> GetAllWidgets() { try { var entities = _dbcontext.DB_Widgets.Where(o => o.IsActive == true).ToList(); return(_widgetMapper.GetDTOs(entities)); } catch (Exception e) { throw e; } }
public DashboardDetailDTO GetDashboardWigetsByDashboardId(int id) { try { var db = _dbcontext.DB_Dashboards.Single(o => o.Id == id); var entities = _dbcontext.DB_DashboardWidgets.Include(o => o.Widget).Include(o => o.DashboardWidgetSettings).Where(o => o.DashboardId == id); var widgets = _dashboardWidgetMapper.GetDTOs(entities.ToList()); return(new DashboardDetailDTO() { Id = db.Id, Name = db.Name, GlobalFilterId = db.GlobalFilterId, DashboardWidgets = widgets }); } catch (Exception e) { throw e; } }