Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("ShippingMethodID,Name")] ShippingMethod shippingMethod)
        {
            if (ModelState.IsValid)
            {
                _context.Add(shippingMethod);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(shippingMethod));
        }
        public async Task <IActionResult> Create([Bind("PageConfigurationID,CustomerID,SendingNewsletter,ShowNetPrices,ProductsPerPage,InterfaceSkin,Language,Currency")] PageConfiguration pageConfiguration)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pageConfiguration);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pageConfiguration));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("ExpertID,FirstName,LastName,Email")] Expert expert)
        {
            if (ModelState.IsValid)
            {
                _context.Add(expert);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(expert));
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("AddressID,CustomerID,Country,Town,PostCode,Street,HouseNumber,ApartmentNumber")] Address address)
        {
            if (ModelState.IsValid)
            {
                _context.Add(address);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(address));
        }
        public async Task <IActionResult> Create([Bind("DiscountCodeID,DiscoundCode,Percent")] DiscountCode discountCode)
        {
            if (ModelState.IsValid)
            {
                _context.Add(discountCode);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(discountCode));
        }
Esempio n. 6
0
        public async Task <IActionResult> Create([Bind("CategoryID,ParentCategoryID,Name,Visibility")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ParentCategoryID"] = new SelectList(_context.Categories, "CategoryID", "CategoryID", category.ParentCategoryID);
            return(View(category));
        }
        public async Task <IActionResult> Create([Bind("AttachmentID,ProductID,Path,Description")] Attachment attachment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(attachment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProductID"] = new SelectList(_context.Products, "ProductID", "ProductID", attachment.ProductID);
            return(View(attachment));
        }
Esempio n. 8
0
        public async Task <IActionResult> Create([Bind("ProductOrderID,ProductID,OrderID")] ProductOrder productOrder)
        {
            if (ModelState.IsValid)
            {
                _context.Add(productOrder);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderID"]   = new SelectList(_context.Orders, "OrderID", "OrderID", productOrder.OrderID);
            ViewData["ProductID"] = new SelectList(_context.Products, "ProductID", "ProductID", productOrder.ProductID);
            return(View(productOrder));
        }
Esempio n. 9
0
        public async Task <IActionResult> Create([Bind("ProductID,CategoryID,ExpertID,Name,ProductDescription,Image,DateAdded,Promotion,VAT,Price,Amount,Visibility,SoldProducts")] Product product)
        {
            if (ModelState.IsValid)
            {
                _context.Add(product);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryID"] = new SelectList(_context.Categories, "CategoryID", "CategoryID", product.CategoryID);
            ViewData["ExpertID"]   = new SelectList(_context.Experts, "ExpertID", "ExpertID", product.ExpertID);
            return(View(product));
        }
Esempio n. 10
0
        public async Task <IActionResult> Create([Bind("CustomerID,AddressID,PageConfigurationID,FirstName,LastName,Login,Password,Email,AdminRights")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddressID"]           = new SelectList(_context.Addresses, "AddressID", "AddressID", customer.AddressID);
            ViewData["PageConfigurationID"] = new SelectList(_context.PageConfigurations, "PageConfigurationID", "PageConfigurationID", customer.PageConfigurationID);
            return(View(customer));
        }
Esempio n. 11
0
        public async Task <IActionResult> Create([Bind("OrderID,CustomerID,ShippingMethodID,PaymentMethodID,OrderStatus")] Order order)
        {
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerID"]       = new SelectList(_context.Customers, "CustomerID", "CustomerID", order.CustomerID);
            ViewData["PaymentMethodID"]  = new SelectList(_context.PaymentMethods, "PaymentMethodID", "PaymentMethodID", order.PaymentMethodID);
            ViewData["ShippingMethodID"] = new SelectList(_context.ShippingMethods, "ShippingMethodID", "ShippingMethodID", order.ShippingMethodID);
            return(View(order));
        }