public async Task <IActionResult> GetAllPricesFullAsync() { var prices = await _pricesRepository.GetAllPricessAsync(); var prods = await _productsRepository.GetAllProductsAsync(); var supps = await _suppliersRepository.GetAllSuppliersAsync(); var list = from pri in prices join pro in prods on pri.ProductId equals pro.ProductId join su in supps on pri.SupplierId equals su.SupplierId select new PriceFullViewModel { Product = pro.Name, Price = pri.Cost, Supplier = su.Name }; return(new OkObjectResult(list)); }
public async Task <IActionResult> GetAllSuppliersAsync() { try{ IEnumerable <Supplier> suppList = await _repo.GetAllSuppliersAsync(); if (suppList != null) { var list = suppList.Select(s => new SupplierViewModel { Id = s.SupplierId, Name = s.Name }); return(new OkObjectResult(list)); } else { return(new NotFoundResult()); } }catch { return(new ConflictResult()); } }