Ejemplo n.º 1
0
        // GET: LocPhoneExts/Create
        public ActionResult Manage(int id)
        {
            LocPhoneNums phoneNums = context.LocPhoneNums.FirstOrDefault(p => p.Id == id);
            LocationPhoneExtensionsViewModel model = new LocationPhoneExtensionsViewModel
            {
                PhoneNums = phoneNums,
                Location  = context.Locations
                            .FirstOrDefault(l => l.Id == phoneNums.LocationId),

                LocPhoneExts = new LocPhoneExts()
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        // GET: LocPhoneExts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                TempData["alert"] = "Sorry, I could not find the item you were looking for. Please try again.";
                return(View("~/Locations"));
            }
            LocPhoneExts phoneExts = context.LocPhoneExts.FirstOrDefault(e => e.Id == id);
            LocPhoneNums phones    = context.LocPhoneNums.FirstOrDefault(p => p.Id == phoneExts.LocPhoneNumsId);
            LocationPhoneExtensionsViewModel model = new LocationPhoneExtensionsViewModel
            {
                Location     = context.Locations.FirstOrDefault(p => p.Id == phones.LocationId),
                LocPhoneExts = phoneExts,
                PhoneNums    = phones
            };

            if (phoneExts == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }