public async Task <IEnumerable <FactoryDeviceDto> > Get([FromQuery] PaginationOpts paginationOpts) { return((await _factoryDeviceService.GetAll(paginationOpts)) .Select(fd => new FactoryDeviceDto { Id = fd.Id, Name = fd.Name, Year = fd.Year, Type = fd.Type } )); }
public async Task <IEnumerable <FactoryDeviceDto> > Get() { return((await _factoryDeviceService.GetAll()) .Select(fd => new FactoryDeviceDto { Id = fd.Id, Name = fd.Name, Year = fd.Year, Type = fd.Type } )); }
public async Task <IEnumerable <FactoryDeviceDto> > Get(string kohde) { //Ensin tarkistetaan onko kutsussa hakuparametria "kohde" tarkistamalla, onko se null tai tyhjä if (String.IsNullOrEmpty(kohde)) { //Jos "kohde" on tyhjä, noudetaan kaikki tiedot normaalisti GetAll-haulla return((await _factoryDeviceService.GetAll()) .Select(fd => new FactoryDeviceDto { Id = fd.Id, Kirjausaika = fd.Kirjausaika, Kohde = fd.Kohde, Kriittisyys = fd.Kriittisyys, Kuvaus = fd.Kuvaus, Tila = fd.Tila } )); } else if (!String.IsNullOrEmpty(kohde)) { //Jos "kohde"-parametrissa on tekstiä, haetaan sen avulla vain kohteet, jotka sisältävät sen GetAllKohde-haun avulla. return((await _factoryDeviceService.GetAllKohde(kohde)) .Select(fd => new FactoryDeviceDto { Id = fd.Id, Kirjausaika = fd.Kirjausaika, Kohde = fd.Kohde, Kriittisyys = fd.Kriittisyys, Kuvaus = fd.Kuvaus, Tila = fd.Tila } )); } else { return(null); } }
public async Task <IEnumerable <FactoryDeviceDto> > Get() { return((await _factoryDeviceService.GetAll()) .Select(fd => FormFactoryDevDto(fd))); }