public async Task <IActionResult> Create([Bind("Id,FullName,Age,Address,PhoneNumber,PassportData,Position")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(employee)); }
public async Task <IActionResult> Create([Bind("Id,Name,Description")] TypeOfCargo typeOfCargo) { if (ModelState.IsValid) { _context.Add(typeOfCargo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(typeOfCargo)); }
public async Task <IActionResult> Create([Bind("Id,Name,MaxSpeed,Description,Type")] CarBrand carBrand) { if (ModelState.IsValid) { _context.Add(carBrand); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(carBrand)); }
public async Task <IActionResult> Create([Bind("Id,Name,TypeOfCargoId,ShelfLife,Features")] Cargo cargo) { if (ModelState.IsValid) { _context.Add(cargo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TypeOfCargoId"] = new SelectList(_context.TypeOfCargos, "Id", "Name", cargo.TypeOfCargoId); return(View(cargo)); }
public async Task <IActionResult> Create([Bind("Id,RegNumber,VinNumber,EngineNumber,YearOfIssue,TechInspection,EmployeeId,CarBrandId")] Car car) { if (ModelState.IsValid) { _context.Add(car); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CarBrandId"] = new SelectList(_context.CarBrands, "Id", "Name", car.CarBrandId); ViewData["EmployeeId"] = new SelectList(_context.Employees, "Id", "FullName", car.EmployeeId); return(View(car)); }
public async Task <IActionResult> Create([Bind("Id,Customer,StartPoint,EndPoint,StartDate,EndDate,CarId,CargoId,Price,IsPayment,IsReturn")] Flight flight) { if (ModelState.IsValid) { _context.Add(flight); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CarId"] = new SelectList(_context.Cars, "Id", "RegNumber", flight.CarId); ViewData["CargoId"] = new SelectList(_context.Cargos, "Id", "Name", flight.CargoId); return(View(flight)); }