public ForumView CreateForum(ForumForm value, UserIdentity identity) { var forum = new ForumObj { Id = ObjectId.GenerateNewId().ToString(), Name = value.Name, UrlPicture = value.Image, Description = value.Description, Channels = new List <Channel>(), Users = new List <User>() }; lock ( LockObject ) { forum.Users.Add(new User { Id = identity.ID, Pseudo = identity.Pseudo, UrlPicture = Config.URL + "/account/picture/" + identity.ID }); this.Context.GetCollection().InsertOne(forum); } if (forum.Id != null) { return(this.GetForumById(forum.Id).ToViewForum()); } return(forum.ToViewForum()); }
public async Task <ActionResult <ForumView> > CreateForum([FromBody] ForumForm value) { ForumView forum = this.Manager.CreateForum(value, this.Identity); await this.Context.Clients.AllExcept(new string[] { Identity.ID }).SendAsync("onNewForum", forum); return(this.Ok(forum)); }