Пример #1
0
        public async Task <IActionResult> InitiateNewPOSTrans()
        {
            SalesOrder salesOrder = new SalesOrder();

            salesOrder.Number         = _pos.GenerateSONumber();
            salesOrder.SalesOrderDate = DateTime.Now;
            //random customer
            Customer cust = new Customer();

            cust = await _context.Customer.FirstOrDefaultAsync();

            if (cust != null)
            {
                salesOrder.CustomerId = cust.CustomerId;
            }

            _context.SalesOrder.Add(salesOrder);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSalesOrder", new { id = salesOrder.SalesOrderId }, salesOrder));
        }
Пример #2
0
 // GET: SalesOrders/Create
 public IActionResult Create()
 {
     ViewData["CustomerId"] = new SelectList(_context.Customer, "CustomerId", "Name");
     ViewData["Number"]     = _pos.GenerateSONumber();
     return(View());
 }