Exemplo n.º 1
0
        public ViewResult List()
        {
            ViewBag.Title = "Phones";
            PhoneListVM obj = new PhoneListVM();

            obj.Phones          = _allPhones.Phones;
            obj.currentCategory = "Best";

            return(View(obj));
        }
Exemplo n.º 2
0
        // GET: Phones
        public ActionResult List()
        {
            PhonesService phoneService = new PhonesService();
            PhoneListVM   model        = new PhoneListVM();

            TryUpdateModel(model);

            if (!model.ContactID.HasValue)
            {
                return(ControllerExtensions.RedirectToAction <ContactsController>(this, c => c.List()));
            }

            model.Contact = phoneService.GetContact(model.ContactID.Value);
            model.Phones  = phoneService.GetAll().Where(p => p.ContactID == model.ContactID.Value).ToList();


            return(View(model));
        }