void ReleaseDesignerOutlets() { if (CatView != null) { CatView.Dispose(); CatView = null; } if (PageView != null) { PageView.Dispose(); PageView = null; } if (PreviousButton != null) { PreviousButton.Dispose(); PreviousButton = null; } if (NextButton != null) { NextButton.Dispose(); NextButton = null; } }
public IActionResult Details(int id) { using (var db = new FDMCDbContext()) { var cat = db.Cats.FirstOrDefault(c => c.Id == id); if (cat == null) { ViewData["Message"] = "Error! There is no such cat!"; return(View()); } var catView = new CatView() { Name = cat.Name, Age = cat.Age, Breed = cat.Breed, ImageUrl = cat.ImageUrl }; return(View(catView)); } }