示例#1
0
        public async Task <ActionResult> Create([Bind(Include = "OrderID,DateOrder,DateDelivery")] Order order)
        {
            if (ModelState.IsValid)
            {
                db.Orders.Add(order);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(order));
        }
示例#2
0
        public async Task <ActionResult> Create([Bind(Include = "SellerId,DateOfBirth,Lastname,Firstname,Address,Postcode,City,PhoneNumber")] Seller seller)
        {
            if (ModelState.IsValid)
            {
                db.Sellers.Add(seller);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(seller));
        }
示例#3
0
        public async Task <ActionResult> Create([Bind(Include = "CategoryId,Name,Description,Price,Tva")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.DbCategory.Add(category);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
示例#4
0
        public async Task <ActionResult> Create([Bind(Include = "ClientId,Lastname,Firstname,Address,Postcode,City,PhoneNumber")] Client client)
        {
            if (ModelState.IsValid)
            {
                db.Clients.Add(client);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(client));
        }
示例#5
0
        public async Task <ActionResult> Create([Bind(Include = "BrandId,Name,Description")] Brand brand)
        {
            if (ModelState.IsValid)
            {
                db.DbBrand.Add(brand);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(brand));
        }
示例#6
0
        public async Task <ActionResult> Create([Bind(Include = "CarId,Name,Year,Color,Avalaible,TimeAssurancy,DelayExchange")] Car car, long categoryId)
        {
            if (ModelState.IsValid)
            {
                car.Category = db.DbCategory.Find(categoryId);
                db.DbCar.Add(car);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(car));
        }