public void Verify() { var type = new PathogenType { Code = 'f', Description = "Fungus" }; var instance = new List <object> { new LookupTable <PathogenDto> { Models = new List <PathogenDto> { new Pathogen { PathogenType = type } } }, new LookupTable <PathogenTypeDto> { Models = new List <PathogenTypeDto> { type } } }; var serializer = new ConfigurationContainer().EnableReferences().ForTesting(); var cycled = serializer.Cycle(instance); var expected = cycled[1].To <LookupTable <PathogenTypeDto> >().Models.Only(); cycled[0].To <LookupTable <PathogenDto> >() .Models[0].PathogenType.Should() .BeSameAs(expected); }
public ActionResult DeleteConfirmed(int id) { PathogenType pathogenType = db.PathogenTypes.Find(id); db.PathogenTypes.Remove(pathogenType); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Name,URL")] PathogenType pathogenType) { if (ModelState.IsValid) { db.Entry(pathogenType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pathogenType)); }
public ActionResult Create([Bind(Include = "ID,Name,URL")] PathogenType pathogenType) { if (ModelState.IsValid) { db.PathogenTypes.Add(pathogenType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pathogenType)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PathogenType pathogenType = db.PathogenTypes.Find(id); if (pathogenType == null) { return(HttpNotFound()); } return(View(pathogenType)); }