public async Task <IActionResult> Create([Bind("EmployeeID,FirstNameMI,LastName,RequestValidation")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(employee));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("CustomerID,FirstNameMI,LastName,DOB,Address,email,PhoneNumber,UserName,password")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("ItemID,ItemName,Price")] Item item)
        {
            if (ModelState.IsValid)
            {
                _context.Add(item);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(item));
        }
        public async Task <IActionResult> Create([Bind("ServicesID,ServiceName,ListedDate,ServiceType,Price,CustomerRating")] Services services)
        {
            if (ModelState.IsValid)
            {
                _context.Add(services);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(services));
        }
        public async Task <IActionResult> Create([Bind("RequestID,ServicesID,CustomerID,ItemID,Vehicle,Description,Cost")] Request request)
        {
            if (ModelState.IsValid)
            {
                _context.Add(request);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CustomerID"] = new SelectList(_context.Customer, "CustomerID", "FirstNameMI", request.CustomerID);
            ViewData["ItemID"]     = new SelectList(_context.Item, "ItemID", "ItemID", request.ItemID);
            ViewData["ServicesID"] = new SelectList(_context.Set <Services>(), "ServicesID", "ServicesID", request.ServicesID);
            return(View(request));
        }