public async Task <IActionResult> Get(MasterValueTypes type) { switch (type) { case MasterValueTypes.MusicGenres: var genres = await _crudService.GetAll <MusicGenre>(); return(Ok(genres.ToList())); case MasterValueTypes.MusicianRoles: var roles = await _crudService.GetAll <MusicianRole>(); return(Ok(roles.ToList())); case MasterValueTypes.WorkTypes: var workTypes = await _crudService.GetAll <WorkType>(); return(Ok(workTypes.ToList())); case MasterValueTypes.Cities: var cities = await _crudService.GetAll <City>(); return(Ok(cities.ToList())); } return(NotFound()); }
public async Task <IActionResult> Get() { if (!_memoryCache.TryGetValue(CacheCategoriesKey, out IEnumerable <object> categories)) { categories = (await _crudService.GetAll <Category>()).Select(c => new { c.Id, c.Title }); _memoryCache.Set(CacheCategoriesKey, categories, TimeSpan.FromDays(30)); } return(Ok(categories)); }