public async Task <IActionResult> Edit(int id, TherapyType therapyType) { if (id != therapyType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _db.Update(therapyType); await _db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TherapyTypeExists(therapyType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(therapyType)); }
private TherapyType AddTherapyType(TherapyType therapyType) { if (therapyType != default) { _therapyTypes.Add(therapyType); _therapyTypes.TryGetValue(therapyType, out therapyType); } return(therapyType); }
public async Task <IActionResult> Create(TherapyType therapyType) { if (ModelState.IsValid) { _db.Add(therapyType); await _db.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(therapyType)); }