public void Add() { EmptyLists(); TreatmentType treatmentType = new TreatmentType(); treatmentTypeRepository = new TreatmentTypeRepository(context); Assert.Equal(10, treatmentTypeRepository.Insert(treatmentType)); }
public void AddFalseInput() { EmptyLists(); treatmentTypeRepository = new TreatmentTypeRepository(context); Exception ex = Assert.Throws <NullReferenceException>(() => treatmentTypeRepository.Insert(null)); Assert.Equal("Het behandelingsType is leeg.", ex.Message); }
public IActionResult Create(TreatmentTypeDetailViewModel vm) { // Check if model is valid if (ModelState.IsValid) { // Push to database TreatmentType tt = converter.ViewModelToModel(vm); long id = repository.Insert(tt); // Return details page of just inserted record return(RedirectToAction("details", new { id })); } else { return(View(vm)); } }