public ActionResult UserGroupsGroupCreate(string name, long?parentId)
        {
            if (this.CurrentUser.IsGroupOwner)
            {
                this.ServiceResponse = groupsService.GroupCreate(this.CurrentUser, name, parentId);
            }

            return(UserGroupsList(null));
        }
Esempio n. 2
0
        public void TestUserGroupServices_Create_Group()
        {
            var sa = GetUserSessionModel("*****@*****.**");

            var toplevel = this.TContext.Groups.Where(g => g.Name == "Test Daikin").FirstOrDefault();
            var save1    = toplevel.ChildrenCountDeep;

            var before = this.TContext.Groups.Where(g => g.Name == "Test Dallas").FirstOrDefault();
            var save2  = before.ChildrenCount;

            var result = service.GroupCreate(sa, "Test Dallas DownTown", before.GroupId);

            var after = this.TContext.Groups.Where(g => g.Name == "Test Dallas").FirstOrDefault();

            var toplevelafter = this.TContext.Groups.Where(g => g.Name == "Test Daikin").FirstOrDefault();

            var newgrp = this.TContext.Groups.Where(g => g.Name == "Test Dallas DownTown").FirstOrDefault();

            Assert.IsTrue(after.ChildrenCount == save2 + 1);

            Assert.IsTrue(toplevelafter.ChildrenCountDeep == save1 + 1);

            Assert.IsTrue(newgrp.Path.IndexOf(after.GroupId.ToString() + "\\" + newgrp.GroupId.ToString()) >= 1);
        }