public ActionResult Create(GroupModel groupModel)
        {
            this.FillSeoInformation("Group Order");

            ViewBag.Scripts = new List <string>()
            {
                "form.js"
            };
            ViewBag.IsContactOrGroup = true;

            groupModel.Brand = this.CurrentBrand;
            groupModel.Inquiry.IndustryList   = GroupManager.GetIndustryList(groupModel.Brand);
            groupModel.Inquiry.StateList      = StateManager.GetStateModelList();
            groupModel.Purchase.OutfittedList = GroupManager.GetOutfittedList(groupModel.Brand);

            if (ModelState.IsValid)
            {
                var ok = GroupManager.Create(groupModel);
                if (ok)
                {
                    return(RedirectToAction("ThankYou"));
                }
                return(RedirectToAction("Index"));
                //return Redirect("/Index#");
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Пример #2
0
        public ActionResult GroupCreate(GroupItem model)
        {
            ModelState["GroupInviteUserMail"].Errors.Clear();

            if (ModelState.IsValid)
            {
                model.OwnerID = SessionManager.UserID;
                Group outGroup = GroupManager.Create(model.ToGroup());

                if (outGroup != null)
                {
                    UsersToGroup addUsersToGroup = new UsersToGroup();
                    addUsersToGroup.GroupID     = outGroup.ID;
                    addUsersToGroup.UserID      = outGroup.OwnerID;
                    addUsersToGroup.GroupRoleID = (int)DML.Enums.GroupRoles.Moderator;
                    UsersToGroupManager.Add(addUsersToGroup);
                    return(RedirectToAction("GroupDetails", "Group", new { id = outGroup.ID }));
                }
                else
                {
                    ModelState.AddModelError("Name", App_GlobalResources.Common.GroupIsCreate);
                    return(View(model));
                }
            }

            return(View(model));
        }
        public void TestGroupStores()
        {
            GroupStore <IdentityGroup> store = new GroupStore <IdentityGroup>();
            var gm       = new GroupManager <IdentityGroup>(store);
            var newGroup = new IdentityGroup("testgroup");

            gm.Create(newGroup);

            var result = CreateAsync().Result;

            Assert.AreEqual(true, result);
        }
        public void TestFindGroup()
        {
            var gstore = new GroupStore <IdentityGroup>();
            var gm     = new GroupManager <IdentityGroup>(gstore);
            var gr     = gm.FindByName("group3");

            if (gr == null)
            {
                gr = new IdentityGroup("group3");
                gm.Create(gr);
            }
            var res = gm.FindById(gr.Id);
        }
        public void TestUser()
        {
            //var ctx = new IdentityDbContext();
            var store  = new UserStore <IdentityUser>();
            var usr    = new IdentityUser("usertest2");
            var um     = new UserManager <IdentityUser>(store);
            var gr     = new IdentityGroup("group3");
            var gstore = new GroupStore <IdentityGroup>();
            var gm     = new GroupManager <IdentityGroup>(gstore);

            if (!gm.Create(gr).Succeeded)
            {
                gm.FindByName("group3");
            }
            if (!um.Create(usr).Succeeded)
            {
                usr = um.FindByName("usertest2");
            }
            um.SetToGroup(usr.Id, "group3");
            //um.Delete(usr);
            //gr.Name = "groupchange";
            //gm.Update(gr);
            //gm.Delete(gr);
        }