Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("Id,Address,ContactPersonName,Email,Name,PhoneNmber")] Supplier supplier)
        {
            if (ModelState.IsValid)
            {
                _context.Add(supplier);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(supplier));
        }
Esempio n. 2
0
        public async Task <IActionResult> Create([Bind("Id,Color,Depth,Description,Height,Name,Price,Width,amountInStock,tags")] ItemModel itemModel, [Bind("Image")] ICollection <IFormFile> Image, int supplier)
        {
            if (ModelState.IsValid)
            {
                saveImages(itemModel, Image);
                itemModel.supplier = _context.Supplier.FirstOrDefault(m => m.Id == supplier);
                _context.Add(itemModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(itemModel));
        }
        public async Task <IActionResult> Create([Bind("Id,SheepingAddress,clientName,phoneNumber")] OrderModel orderModel, int itemId)
        {
            if (ModelState.IsValid)
            {
                orderModel.status     = OrderStatus.New;
                orderModel.orderdItem = _context.Items.FirstOrDefault(m => m.Id == itemId);

                _context.Add(orderModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Details/" + orderModel.Id));
            }
            return(RedirectToAction("index", "Home", null));
        }