public ActionResult Edit(int id) { using (var ctx = new ApplicationDbContext()) { ViewBag.ShelterList = ctx.Shelters.Select (s => new SelectListItem() { Text = s.ShelterName, Value = s.ShelterId.ToString() } ).ToList(); } var service = new CatService(); var detail = service.GetCatById(id); var model = new CatEdit { CatId = detail.CatId, CatName = detail.CatName, CatSex = detail.CatSex, CatWeight = detail.CatWeight, CatAge = detail.CatAge, CatPrice = detail.CatPrice, CatImage = detail.CatImage, ShelterId = detail.ShelterId }; return(View(model)); }
public ActionResult Details(int id) { var svc = new CatService(); var model = svc.GetCatById(id); return(View(model)); }