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