public async Task <IActionResult> Edit(int id, [Bind("AlcoholRiskId,DrinkAlc,DailyDrinkCount,WeekendDrinkCount,SocialDrinkCount,YearsQuitDrinking,TreatedForAlcAbuse,YearTreated,LengthOfTreatment,TypeOfTreatment,Comments")] AlcoholRisk alcoholRisk) { if (id != alcoholRisk.AlcoholRiskId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(alcoholRisk); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AlcoholRiskExists(alcoholRisk.AlcoholRiskId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(alcoholRisk)); }
public async Task <IActionResult> Create([Bind("AlcoholRiskId,DrinkAlc,DailyDrinkCount,WeekendDrinkCount,SocialDrinkCount,YearsQuitDrinking,TreatedForAlcAbuse,YearTreated,LengthOfTreatment,TypeOfTreatment,Comments")] AlcoholRisk alcoholRisk) { if (ModelState.IsValid) { _context.Add(alcoholRisk); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(alcoholRisk)); }