public void WhenIUpdateADocType_AndTheDocTypeDoesNotExist_ThenAnExceptionIsThrown() { _docTypeRepository.Create(_docType1); DocType docType = _docTypeRepository.Entities.Where(p => p.Code == "code").FirstOrDefault(); Assert.Throws <UnityException>(() => _docTypeRepository.Update(docType.Id + 1001, "code 1", "description name 1")); }
public ActionResult Edit(DocTypeViewModel model) { try { // TODO: Add update logic here var docType = DocTypeRepository.Update(model.DocType.Id.Value, model.DocType.Name, model.DocType.Description, model.DocType.MetaTags); return(RedirectToAction("Index")); } catch { return(View(model)); } }