public ActionResult Edit(int id)
        {
            var service = CreateTrackingService();
            var detail  = service.GetTrackingById(id);
            var model   =
                new TrackingEdit
            {
                TrackingId    = detail.TrackingId,
                TrackDate     = detail.TrackDate,
                SymptomAnswer = detail.SymptomAnswer,
                ContactAnswer = detail.ContactAnswer,
                TempAnswer    = detail.TempAnswer,
                Temperature   = detail.Temperature,
                MaskAnswer    = detail.MaskAnswer,
                GroupAnswer   = detail.GroupAnswer,
                EmpId         = detail.EmpId,
                FullName      = detail.FullName
            };

            return(View(model));
        }
        public bool UpdateTracking(TrackingEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Trackings
                    .Single(e => e.TrackingId == model.TrackingId && e.IndividualId == _userId);

                entity.TrackingId    = model.TrackingId;
                entity.TrackDate     = model.TrackDate;
                entity.SymptomAnswer = model.SymptomAnswer;
                entity.ContactAnswer = model.ContactAnswer;
                entity.TempAnswer    = model.TempAnswer;
                entity.Temperature   = model.Temperature;
                entity.MaskAnswer    = model.MaskAnswer;
                entity.GroupAnswer   = model.GroupAnswer;
                entity.EmpId         = model.EmpId;


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

            if (model.TrackingId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }
            var service = CreateTrackingService();

            if (service.UpdateTracking(model))
            {
                TempData["SaveResult1"] = "The tracking date was updated.";
                return(RedirectToAction("Index"));
            }

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