示例#1
0
        // GET: Rent/Init
        public async Task <IActionResult> Init()
        {
            Rent rent = new Rent();

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

            return(RedirectToAction("Create", "Inspection", new { rentId = rent.Id }));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("Id,Description,State")] Brand brand)
        {
            if (ModelState.IsValid)
            {
                _context.Add(brand);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(brand));
        }
示例#3
0
        public async Task <IActionResult> Create([Bind("Name,IdentificationCardNumber,WorkSchedule,CommissionPercentage,EntryDate,State")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(employee));
        }
示例#4
0
        public async Task <IActionResult> Create([Bind("ID,naziv")] Marka marka)
        {
            if (ModelState.IsValid)
            {
                _context.Add(marka);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(marka));
        }
示例#5
0
        public async Task <IActionResult> Create([Bind("Id,Name,IdentificationCardNumber,PersonType,CreditCarNumber,CreditLimit,State")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(client));
        }
示例#6
0
        public async Task <IActionResult> Create([Bind("ID,Naziv,ReleaseDate,Model,Cijena,MarkaID")] Cars cars)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cars);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MarkaID"] = new SelectList(_context.Set <Marka>(), "ID", "ID", cars.MarkaID);
            return(View(cars));
        }
示例#7
0
        public async Task <IActionResult> Create(int brandId, [Bind("Description,State")] Model model)
        {
            if (ModelState.IsValid)
            {
                model.Brand = await _context.Brands.SingleOrDefaultAsync(b => b.Id == brandId);

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

                return(RedirectToAction("Index"));
            }

            AddBrandsToViewBag();
            return(View(model));
        }
示例#8
0
        public async Task <IActionResult> Create(int vehicleTypeId, int modelId, int fuelTypeId, [Bind("Description,ChassisNumber,EngineNumber,PlateNumber,State")] Vehicle vehicle)
        {
            if (ModelState.IsValid)
            {
                vehicle.VehicleType = await _context.VehicleTypes.SingleOrDefaultAsync(vt => vt.Id == vehicleTypeId);

                vehicle.Model = await _context.Models.SingleOrDefaultAsync(m => m.Id == modelId);

                vehicle.FuelType = await _context.FuelTypes.SingleOrDefaultAsync(ft => ft.Id == fuelTypeId);

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

                return(RedirectToAction("Index"));
            }
            AddDataToViewBag();
            return(View(vehicle));
        }