Пример #1
0
        public bool CreateCheckList(GroupCheckListCreate model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity = new MasterGroup.Data.GroupCheckLists()
                {
                    ListId      = model.ListId,
                    Check1      = model.Check1,
                    Check2      = model.Check2,
                    Check3      = model.Check3,
                    ModifiedUtc = DateTimeOffset.Now
                };
                ctx.MGLists.Add(entity);
                ctx.SaveChanges();

                return(ctx.SaveChanges() == 1);
            }
        }
Пример #2
0
        public ActionResult Create(GroupCheckListCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

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

            if (sv2)
            {
                TempData["SaveResult"] = "Your Check List was created.";
                return(RedirectToAction("Index"));
            }
            ;

            ModelState.AddModelError("", "Check List could not be created.");

            return(View(model));
        }