Ejemplo n.º 1
0
        public ActionResult Edit(int id)
        {
            var service = new ScheduleAdminService(id);
            var detail  = service.GetScheduleAdminById(id);
            var model   =
                new ScheduleAdminEdit
            {
                EventID     = detail.EventID,
                ShopID      = detail.ShopID,
                EventName   = detail.EventName,
                StartTime   = detail.StartTime,
                EndTime     = detail.EndTime,
                ModifiedUtc = detail.ModifiedUtc
            };

            return(View(model));
        }
Ejemplo n.º 2
0
        public bool UpdateScheduleAdmin(ScheduleAdminEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .ScheduleAdmin
                    .Single(e => e.EventID == model.EventID);
                entity.ShopID      = model.ShopID;
                entity.EventID     = model.EventID;
                entity.EventName   = model.EventName;
                entity.StartTime   = model.StartTime;
                entity.EndTime     = model.EndTime;
                entity.ModifiedUtc = DateTimeOffset.Now;


                return(ctx.SaveChanges() == 1);
            }
        }
Ejemplo n.º 3
0
        public ActionResult Edit(int id, ScheduleAdminEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

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

            var service = new ScheduleAdminService(id);

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

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