public ActionResult Edit(string id)
        {
            var service = CreateSpotterService();
            var detail  = service.GetSpotterByID(id);
            var model   =
                new SpotterEdit
            {
                Id        = detail.Id,
                FirstName = detail.FirstName,
                LastName  = detail.LastName
            };

            return(View(model));
        }
        public bool UpdateSpotter(SpotterEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Spotters
                    .Single(e => e.Id == model.Id);

                entity.FirstName = model.FirstName;
                entity.LastName  = model.LastName;

                return(ctx.SaveChanges() == 1);
            }
        }
        public ActionResult Edit(string id, SpotterEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.Id != id)
            {
                ModelState.AddModelError("", "ID Mismatch");
                return(View(model));
            }

            var service = CreateSpotterService();

            if (service.UpdateSpotter(model))
            {
                TempData["SaveResult"] = "The spotter was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "The spotter could not be updated.");
            return(View(model));
        }