public async Task <IActionResult> Create([Bind("FlavourId,FlavourName,FlavourDescription")] Flavour flavour) { if (ModelState.IsValid) { _context.Add(flavour); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(flavour)); }
public async Task <IActionResult> Create([Bind("BrandId,BrandName")] Brand brand) { if (ModelState.IsValid) { _context.Add(brand); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(brand)); }
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)); }
public async Task <IActionResult> Create([Bind("DistributorId,DistributorName,DistributorContactNo")] Distributor distributor) { if (ModelState.IsValid) { _context.Add(distributor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(distributor)); }
public async Task <IActionResult> Create([Bind("IceCreamId,IceCreamName,IceCreamDescription,IceCreamPrice,BrandId,FlavourId,DistributorId,CategoryId")] IceCream iceCream) { if (ModelState.IsValid) { _context.Add(iceCream); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BrandId"] = new SelectList(_context.Brands, "BrandId", "BrandId", iceCream.BrandId); ViewData["CategoryId"] = new SelectList(_context.Categories, "CategoryId", "CategoryId", iceCream.CategoryId); ViewData["DistributorId"] = new SelectList(_context.Distributors, "DistributorId", "DistributorId", iceCream.DistributorId); ViewData["FlavourId"] = new SelectList(_context.Flavours, "FlavourId", "FlavourId", iceCream.FlavourId); return(View(iceCream)); }