public async Task <IActionResult> Create([Bind("CustomerId,Title,FirstName,LastName,DOB,Phone,Address")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(customer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customer));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("CategoryId,CategoryName")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("HamperId,HamperName,TotalPrice")] Hamper hamper)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hamper);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(hamper));
        }
        public async Task <IActionResult> Create([Bind("HamperCategoryId,HamperCategoryName,Description,Discontinued")] HamperCategory hamperCategory)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hamperCategory);
                await _context.SaveChangesAsync();

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