示例#1
0
        // GET: LocPhoneNums/Create
        public ActionResult Manage(int id)
        {
            LocationPhonesViewModel model = new LocationPhonesViewModel
            {
                Location = context.Locations
                           .FirstOrDefault(p => p.Id == id),

                LocPhoneNums = new LocPhoneNums()
            };

            return(View(model));
        }
 // GET: LocPhoneNums/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");
     }
     LocPhoneNums locPhoneNums = context.LocPhoneNums.FirstOrDefault(p => p.Id == id);
     LocationPhonesViewModel model = new LocationPhonesViewModel
     {
         Location = context.Locations.FirstOrDefault(l => l.Id == locPhoneNums.LocationId),
         LocPhoneNums = locPhoneNums
     };
     if (locPhoneNums == null)
     {
         return HttpNotFound();
     }
     return View(model);
 }
示例#3
0
        // GET: LocPhoneNums/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"));
            }
            LocPhoneNums            locPhoneNums = context.LocPhoneNums.FirstOrDefault(p => p.Id == id);
            LocationPhonesViewModel model        = new LocationPhonesViewModel
            {
                Location     = context.Locations.FirstOrDefault(l => l.Id == locPhoneNums.LocationId),
                LocPhoneNums = locPhoneNums
            };

            if (locPhoneNums == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }
        // GET: LocPhoneNums/Create
        public ActionResult Manage(int id)
        {
            LocationPhonesViewModel model = new LocationPhonesViewModel
            {
                Location = context.Locations
                .FirstOrDefault(p => p.Id == id),

                LocPhoneNums = new LocPhoneNums()

            };
            return View(model);
        }