public async Task <IActionResult> Create([Bind("passportID,No,RegistationDate,Level")] Passport passport) { if (ModelState.IsValid) { _context.Add(passport); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(passport)); }
public async Task <IActionResult> Create([Bind("BrandId,Name,Description")] Brand brand) { if (ModelState.IsValid) { _context.Add(brand); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(brand)); }
public async Task <IActionResult> Create([Bind("EmployeeID,Email,Name,Surname,passportID")] Employee employee) { if (ModelState.IsValid) { _context.Add(employee); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["passportID"] = new SelectList(_context.Passports, "passportID", "Level", employee.passportID); return(View(employee)); }
public async Task <IActionResult> Create([Bind("EmployeeID,Age,Address,City,Country")] EmployeeDetails employeeDetails) { if (ModelState.IsValid) { _context.Add(employeeDetails); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EmployeeID"] = new SelectList(_context.Employees, "EmployeeID", "Name", employeeDetails.EmployeeID); return(View(employeeDetails)); }
public async Task <IActionResult> Create([Bind("carID,Name,CarImage,Model,price,Year,Run,BrandID")] Car car) { if (ModelState.IsValid) { _context.Add(car); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BrandID"] = new SelectList(_context.Brands, "BrandId", "Description", car.BrandID); return(View(car)); }
public async Task <IActionResult> Create([Bind("ID,StartTime,EndTime,EmployeeId,CarId")] RentedCars rentedCars) { if (ModelState.IsValid) { _context.Add(rentedCars); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CarId"] = new SelectList(_context.Cars, "carID", "Name", rentedCars.CarId); ViewData["EmployeeId"] = new SelectList(_context.Employees, "EmployeeID", "Name", rentedCars.EmployeeId); return(View(rentedCars)); }
public void Add(Employee employee) { _context.Add(employee); }