public IEnumerable <GymViewModel> Get() { return(_gymService.GetGyms().Select(p => new GymViewModel { Id = p.Id, Title = p.Title, Address = p.Address, Image = $"/img/uploaded/{p.Images.FirstOrDefault(k => !k.IsCoverPhoto)?.FileName.FileName}" })); }
public IActionResult GetGyms() { Log.Information("Attempting to retrieve gyms."); List <Gym> g = _GymService.GetGyms(); if (g == null) { Log.Error("Failed to retrieve gyms."); return(BadRequest()); } else { Log.Information("Gyms retrieved successfully."); return(Ok(g)); } }
public IActionResult List() { var list = _gymService.GetGyms(); return(View(list)); }