public async Task <IActionResult> Edit(int id, [Bind("Id, FirstName, LastName, Address, City, State, Zipcode")] DrinkConsumers drinkConsumers) { if (id != drinkConsumers.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(drinkConsumers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DrinkConsumersExists(drinkConsumers.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(drinkConsumers)); }
public async Task <IActionResult> Create([Bind("Id, FirstName, LastName, Address, City, State, Zipcode")] DrinkConsumers drinkConsumers) { if (ModelState.IsValid) { _context.Add(drinkConsumers); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(drinkConsumers)); }
public DrinkConsumersController(ApplicationDbContext context) { drinkConsumers = new DrinkConsumers(); _context = context; }