Exemple #1
0
        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));
        }
Exemple #2
0
        public ActionResult Details(int id)
        {
            var svc   = new CatService();
            var model = svc.GetCatById(id);

            return(View(model));
        }