public async Task <AppThemeModel> GeCurrentTheme(AppThemeModel model) { var theme = await _dbContext.AppThemes.Where(item => item.HostName == model.HostName).FirstOrDefaultAsync(); if (theme == null) { theme = _dbContext.AppThemes.Where(item => item.HostName == "default").FirstOrDefault(); } var themeElements = await _dbContext.ThemeElement.Where(item => item.ThemeId == theme.Id).ToListAsync(); foreach (ThemeElements te in themeElements) { var elem = te.MapTo <ThemeElementModel>(); elem.Type = te.Type.ToString(); model.Elements.Add(elem); } return(model); }
public async Task <AppThemeModel> GetCurrentTheme([FromBody] AppThemeModel model) { try { return(await _manager.GeCurrentTheme(model)); } catch (GenericException ex) { return(new AppThemeModel { error = ex.Code }); } catch (Exception ex) { return(new AppThemeModel { error = ex.Message, stackTrace = ex.StackTrace }); } }
public async Task <AppThemeModel> GeCurrentTheme(AppThemeModel model) { return(await _repo.GeCurrentTheme(model)); }