public async Task <IActionResult> Edit(int id, [Bind("SmoothieId,SmoothieName,SmoothieCalories,SmoothiePrice,SmoothieIngredients,SmoothieImage")] Smoothies smoothies) { if (id != smoothies.SmoothieId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(smoothies); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SmoothiesExists(smoothies.SmoothieId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(smoothies)); }
public async Task <IActionResult> Create([Bind("SmoothieId,SmoothieName,SmoothieCalories,SmoothiePrice,SmoothieIngredients,SmoothieImage,")] Smoothies smoothies) { if (ModelState.IsValid) { _context.Add(smoothies); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(smoothies)); }