Example #1
0
        public IHttpActionResult UpdateMember(int id, int userid, [FromBody] Access access)
        {
            var space = SpaceService.Get(id);

            if (space == null)
            {
                ThrowResponseException(HttpStatusCode.NotFound, $"Space with id {id} not found.");
            }
            return(Ok(SpaceService.AddMember(id, userid, access)));
        }
Example #2
0
        public IHttpActionResult AddMembers(int id, int[] members)
        {
            var space = SpaceService.Get(id);

            if (space == null)
            {
                ThrowResponseException(HttpStatusCode.NotFound, $"Space with id {id} not found.");
            }
            var inserted = new List <Member>();

            foreach (var member in members)
            {
                var user = UserService.Get(member);
                if (user != null)
                {
                    inserted.Add(SpaceService.AddMember(id, user.Id));
                }
            }
            return(Ok(inserted));
        }