public async Task <IActionResult> Edit(int id, [Bind("Id,TotalCalories,TotalCarbs,TotalFats,TotalProtein")] Total total) { if (id != total.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(total); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TotalExists(total.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(total)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,Name,Food_Group,Calories,Fat_g,Protein_g,Carbohydrate_g")] Master_Food master_Food) { if (id != master_Food.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(master_Food); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!Master_FoodExists(master_Food.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(master_Food)); }
public async Task <IActionResult> Edit(int id, [Bind("FoodId,FoodName,Calories,Fat,Carbs,Protein,Sugar")] MacronutrientMeasurement macronutrientMeasurement) { if (id != macronutrientMeasurement.FoodId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(macronutrientMeasurement); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MacronutrientMeasurementExists(macronutrientMeasurement.FoodId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(macronutrientMeasurement)); }
public async Task <IActionResult> Edit(int id, [Bind("UserId,FirstName,LastName,Email,UserPassword,Height,Weight,Age")] AccountInfo accountInfo) { if (id != accountInfo.UserId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(accountInfo); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AccountInfoExists(accountInfo.UserId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(accountInfo)); }