Пример #1
0
        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));
        }
Пример #2
0
        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));
        }
Пример #3
0
        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));
        }
Пример #5
0
        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));
        }
Пример #6
0
        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));
        }
Пример #7
0
 public void Add(Employee employee)
 {
     _context.Add(employee);
 }