Example #1
0
        public async Task <IActionResult> Create([Bind("CompanyName,Address,Contact,Id")] Supplier supplier)
        {
            if (ModelState.IsValid)
            {
                _context.Add(supplier);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(supplier));
        }
        public async Task <IActionResult> Create([Bind("PoNo,CreatedBy,Id")] PurchaseOrder purchaseOrder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(purchaseOrder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(purchaseOrder));
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("Size,Color,GasWeight,CylinderWeight,TotalWeight,Brand,Id")] CylinderViewModel cylinder)
        {
            if (ModelState.IsValid)
            {
                var newClylinder = _mapper.Map <Cylinder>(cylinder);
                _context.Add(newClylinder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(List)));
            }
            return(View(cylinder));
        }
Example #4
0
        public async Task <IActionResult> Create([Bind("StockNo,QuantityInStock,UnitPrice,CylinderId,SupplierId,Id")] Stock stock)
        {
            if (ModelState.IsValid)
            {
                _context.Add(stock);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SupplierId"] = new SelectList(_context.Supplier, "Id", "Id", stock.SupplierId);
            return(View(stock));
        }