Ejemplo n.º 1
0
        public ActionResult Edit(int id, CheckListEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            if (model.ListId != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new GroupCheckListService(userId);
            var svc1    = service.UpdateCheckList(model);

            if (svc1)
            {
                TempData["SaveResult"] = "Your Check List was updated.";
                return(RedirectToAction("Detials", "MasterGroup", new{ id = model.ListId }));
            }
            ModelState.AddModelError("", "Your Check List could not be updated.");

            return(View(model));
        }
Ejemplo n.º 2
0
        public bool UpdateCheckList(CheckListEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .MGLists
                    .Single(e => e.ListId == model.ListId);
                entity.Check1      = model.Check1;
                entity.Check2      = model.Check2;
                entity.Check3      = model.Check3;
                entity.ModifiedUtc = DateTimeOffset.UtcNow;

                return(ctx.SaveChanges() == 1);
            }
        }
Ejemplo n.º 3
0
        //Get//
        public ActionResult Edit(int id)
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new GroupCheckListService(userId);
            var Jordan  = service.GetCheckListById(id);

            var model = new CheckListEdit
            {
                ListId      = Jordan.ListId,
                Check1      = Jordan.Check1,
                Check2      = Jordan.Check2,
                Check3      = Jordan.Check3,
                ModifiedUtc = DateTimeOffset.UtcNow
            };

            return(View(model));
        }