public async Task <IActionResult> AddGroup(string user, string name) { //var user = User.Claims.Where(Clame => Clame.Type == "Name").FirstOrDefault().Value; await profileservice.AddUserGroup(user, name); await groupservice.AddGroup(name, user); return(Ok()); }
public async Task <String> insert() { var ms_wang = new Profile() { Username = "******", Groups = new List <string>(), Friends = new List <string>() }; ms_wang.Groups.Add("family"); var ms_yang = new Profile() { Username = "******", Groups = new List <string>(), Friends = new List <string>() }; var ms_li = new Profile() { Username = "******", Groups = new List <string>(), Friends = new List <string>() }; var ms_he = new Profile() { Username = "******", Groups = new List <string>(), Friends = new List <string>() }; await profileservice.CreateProfile(ms_wang); await profileservice.CreateProfile(ms_yang); await profileservice.CreateProfile(ms_li); await profileservice.CreateProfile(ms_he); await profileservice.AddUserFriend("wang", "li"); await groupservice.MakeFriend("wang", "li"); await profileservice.AddUserFriend("wang", "yang"); await groupservice.MakeFriend("wang", "yang"); var group1 = new ChatGroup() { name = "family", isFriend = false, owner = "wang", describe = "wei are family", members = new List <string>(), UserLatestRead = new Dictionary <string, ObjectId>(), }; group1.UserLatestRead.Add("wang", ObjectId.GenerateNewId()); group1.members.Add("wang"); await groupservice.MakeGroup(group1); await profileservice.AddUserGroup("he", "family"); await groupservice.AddGroup("he", "family"); await profileservice.AddUserGroup("li", "family"); await groupservice.AddGroup("li", "family"); await userservice.InsertUser(new Models.User() { Username = "******", Password = "******" }); await userservice.InsertUser(new Models.User() { Username = "******", Password = "******" }); await userservice.InsertUser(new Models.User() { Username = "******", Password = "******" }); await userservice.InsertUser(new Models.User() { Username = "******", Password = "******" }); return("Ok"); }