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))); }
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)); }