Example #1
0
        public static void GroupAddAssignment(TeamGroup group, string courseId, Action <TeamGroup> onComplete)
        {
            //POST /api/teams/groups/:groupId/assignment

            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "course", courseId }
            };

            ServerRequest.CallAPI("/teams/groups/" + group._id + "/assignment", HTTPMethod.PUT, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
        }
Example #2
0
        public static void AddGroupToMember(TeamMember member, TeamGroup group, Action <TeamMember> onComplete)
        {
            //POST /api/teams/members/addGroup

            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "member", member._id },
                { "group", group._id }
            };

            ServerRequest.CallAPI("/teams/members/addGroup", HTTPMethod.POST, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
        }
Example #3
0
        public static void CreateGroup(TeamGroup group, Action <TeamGroup> onComplete)
        {
            //POST /api/teams/groups/create

            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "name", group.name },
                { "team", User.current.selectedMembership.team._id }
            };

            ServerRequest.CallAPI("/teams/groups/create", HTTPMethod.POST, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
        }
Example #4
0
 public static void DeleteGroup(TeamGroup group, Action <bool> onComplete)
 {
     ServerRequest.CallAPI("/teams/groups/" + group._id, HTTPMethod.DELETE, null, (response) =>
     {
         ServerRequest.ResponseHandler <Dictionary <string, object> >(response, null, (dict) =>
         {
             if (dict != null && dict.ContainsKey("ok") && System.Convert.ToInt32(dict["ok"]) == 1)
             {
                 onComplete.Invoke(true);
             }
             else
             {
                 onComplete.Invoke(false);
             }
         });
     }, true);
 }
Example #5
0
        public static void UpdateGroup(TeamGroup group, Action <TeamGroup> onComplete)
        {
            //POST /api/teams/groups/create

            List <string> courseIds = new List <string>();

            foreach (InteractiveCourseAssignment ass in group.interactiveCourses)
            {
                courseIds.Add(ass._id);
            }

            Dictionary <string, object> body = new Dictionary <string, object>()
            {
                { "name", group.name },
                { "interactiveCourses", courseIds.ToArray() }
            };

            ServerRequest.CallAPI("/teams/groups/" + group._id, HTTPMethod.PUT, body, (r) => { ServerRequest.ResponseHandler(r, null, onComplete); }, true);
        }