public async Task <IActionResult> CreateAuto([Bind("CarId,ModelId,Price,GraduationYear,BodyTypeId,ColorId,DriveId")] Car car)
        {
            if (ModelState.IsValid)
            {
                _context.Add(car);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(IndexAuto)));
            }
            ViewData["BodyTypeId"] = new SelectList(_context.BodyTypes, "BodyTypeId", "BodyTypeNames", car.BodyTypeId);
            ViewData["ColorId"]    = new SelectList(_context.Colors, "ColorId", "ColorName", car.ColorId);
            ViewData["DriveId"]    = new SelectList(_context.Drives, "DriveId", "DriveType", car.DriveId);
            ViewData["ModelId"]    = new SelectList(_context.Models, "ModelId", "ModelName", car.ModelId);

            return(View(car));
        }
        public async Task <IActionResult> Create(int orderTypeId, [Bind("OrderId,ManagerId,ModelId,CustomerId,OrderTypeId,OrderDate")] Order order)
        {
            order.OrderTypeId = orderTypeId;
            if (ModelState.IsValid)
            {
                _context.Add(order);
                await _context.SaveChangesAsync();

                //return RedirectToAction(nameof(Index));
                return(RedirectToAction("Index", "Orders", new { id = orderTypeId, name = _context.OrderTypes.Where(c => c.OrderTypeId == orderTypeId).FirstOrDefault().OrderName }));
            }
            ViewData["ManagerId"]  = new SelectList(_context.Managers, "ManagerId", "FullName", order.ManagerId);
            ViewData["CustomerId"] = new SelectList(_context.Customers, "CustomerId", "FullName", order.CustomerId);
            ViewData["ModelId"]    = new SelectList(_context.Models, "ModelId", "ModelName", order.ModelId);
            // ViewData["OrderTypeId"] = new SelectList(_context.OrderTypes, "OrderTypeId", "OrderName", order.OrderTypeId);

            // return View(order);
            return(RedirectToAction("Index", "Orders", new { id = orderTypeId, name = _context.OrderTypes.Where(c => c.OrderTypeId == orderTypeId).FirstOrDefault().OrderName }));
        }
示例#3
0
        public async Task <IActionResult> Create([Bind("BodyTypeId,BodyTypeNames")] BodyType bodyType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(bodyType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(bodyType));
        }
        public async Task <IActionResult> Create([Bind("OrderTypeId,OrderName")] OrderType orderType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orderType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(orderType));
        }
        public async Task <IActionResult> Create([Bind("ColorId,ColorName")] Color color)
        {
            if (ModelState.IsValid)
            {
                _context.Add(color);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(color));
        }
示例#6
0
        public async Task <IActionResult> Create([Bind("ServiceId,TypeOfService")] Service service)
        {
            if (ModelState.IsValid)
            {
                _context.Add(service);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(service));
        }
示例#7
0
        public async Task <IActionResult> Create([Bind("ManagerId,FullName,Telephone")] Manager manager)
        {
            if (ModelState.IsValid)
            {
                _context.Add(manager);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(manager));
        }
示例#8
0
        public async Task <IActionResult> Create([Bind("ModelId,ModelName")] Model model)
        {
            if (ModelState.IsValid)
            {
                _context.Add(model);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(model));
        }
        public async Task <IActionResult> Create([Bind("DriveId,DriveType")] Drife drife)
        {
            if (ModelState.IsValid)
            {
                _context.Add(drife);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(drife));
        }