public void UpdateFalseInput() { EmptyLists(); treatmentTypeRepository = new TreatmentTypeRepository(context); Exception ex = Assert.Throws <NullReferenceException>(() => treatmentTypeRepository.Update(null)); Assert.Equal("Het behandelingsType is leeg.", ex.Message); }
public void Update() { EmptyLists(); TreatmentType treatmentType = new TreatmentType() { Id = 9, Name = "doedewas" }; treatmentTypeRepository = new TreatmentTypeRepository(context); Assert.True(treatmentTypeRepository.Update(treatmentType)); }
public IActionResult Edit(TreatmentTypeDetailViewModel vm) { // Check if model is valid if (ModelState.IsValid) { // Update in database TreatmentType tt = converter.ViewModelToModel(vm); repository.Update(tt); if (tt.Active) { return(RedirectToAction("details", new { id = tt.Id })); } else { return(RedirectToAction("index")); } } return(View(vm)); }