public async Task <ActionResult <Vendor> > CreatePo(CapstonePRSContext context, string name, int id) { var PoJoin = from v in context.Vendors join p in context.Products on v.Id equals p.VendorId where v.Id == id join rl in context.RequestLines on p.Id equals rl.ProductId join r in context.Requests on rl.RequestId equals r.Id select new { Price = p.Price, Status = r.Status, Quantity = rl.Quantity, Name = v.Name }; if (name is null) { throw new ArgumentNullException(nameof(name)); } var approved = await PoJoin.Where(r => r.Status == "APPROVED").ToListAsync(); var price = approved.Sum(a => (a.Price * a.Quantity) / 30); return(_context.Vendors.SingleOrDefault(v => v.Name == name)); }
public UsersController(CapstonePRSContext context) { _context = context; }
public ProductsController(CapstonePRSContext context) { _context = context; }
public RequestsController(CapstonePRSContext context) { _context = context; }
public VendorsController(CapstonePRSContext context) { _context = context; }