// 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 })); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }
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)); }