Exemple #1
0
        public ActionResult Edit(int id)
        {
            var service = new ScheduleUserService(Guid.Parse(User.Identity.GetUserId()));
            var detail  = service.GetScheduleUserById(id);
            var model   =
                new ScheduleUserEdit
            {
                ServiceID        = detail.ServiceID,
                EventID          = detail.EventID,
                UserName         = detail.UserName,
                UserNumber       = detail.UserNumber,
                StartTime        = detail.StartTime,
                ServicesVariable = detail.ServicesVariable
            };

            return(View(model));
        }
        public bool UpdateScheduleUser(ScheduleUserEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .ScheduleUser
                    .Single(e => e.EventID == model.EventID);
                entity.EventID          = model.EventID;
                entity.ServiceID        = model.ServiceID;
                entity.UserName         = model.UserName;
                entity.UserNumber       = model.UserNumber;
                entity.StartTime        = model.StartTime;
                entity.ServicesVariable = model.ServicesVariable;
                entity.ShopVariable     = model.ShopVariable;
                entity.ModifiedUtc      = DateTimeOffset.Now;



                return(ctx.SaveChanges() == 1);
            }
        }
Exemple #3
0
        public ActionResult Edit(int id, ScheduleUserEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

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

            var service = new ScheduleUserService(Guid.Parse(User.Identity.GetUserId()));

            if (service.UpdateScheduleUser(model))
            {
                TempData["SaveResult"] = "Your Appointment was updated.";
                return(RedirectToAction("Details", "ScheduleUser", new { id = model.EventID }));//figure this out send to shop schedule!!!!!!!
            }

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