public IReadOnlyList <ServiceGymTypeViewModel> GetServiceGymTypes() { try { var listServiceGymType = _serviceGymTypeRepository.ListAllServieGymTypeService(); var list = new List <ServiceGymTypeViewModel>() { // new ServiceGymTypeServiceViewModel() {Value = null,Text = "Selected ServiceType", Selected = true } }; foreach (var i in listServiceGymType) { list.Add(new ServiceGymTypeViewModel() { Id = int.Parse(i.Id.ToString()), Type = i.Type }); } return(list); } catch (Exception e) { //_logger.LogWarning("Error al devolver la lista serviceGymType, message:" + e.Message); throw new Exception("Error al devolver la lista serviceGymType, message:" + e.Message); } }
public IReadOnlyList <ServiceGymTypeViewModel> GetAllServiceGymTypeViewModel() { try { var listServiceGymType = new List <ServiceGymTypeViewModel>(); var list = _serviceGymTypeRepository.ListAllServieGymTypeService(); list.AsEnumerable(); foreach (var i in list) { var serviceGymType = _converterServiceGymTypeToServiceGymTypeViewModel.Map(i); listServiceGymType.Add(serviceGymType); } return(listServiceGymType); } catch (Exception e) { //_logger.LogWarning("error al traer la lista de servicios, message:", e.Message); throw new Exception("Error al traer la lista de servicegymType, message:" + e.Message); } }