Exemple #1
0
        public async Task <IActionResult> Create([Bind("SalesmanID,PhoneNumber,Email,FirstName,LastName")]
                                                 Salesman salesman)
        {
            if (ModelState.IsValid)
            {
                _context.Add(salesman);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            return(View(salesman));
        }
Exemple #2
0
        public async Task <IActionResult> Create([Bind("BusinessID,BusinessName,DistrictID,Adress,ZipCode")]
                                                 Business business)
        {
            if (ModelState.IsValid)
            {
                _context.Add(business);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }

            ViewData["DistrictID"] =
                new SelectList(_context.Districts, "DistrictID", "DistrictName", business.DistrictID);
            return(View(business));
        }