public async Task <JsonResult> DeleteInvitedList(string memberId, string activityId) { await InitializationModel(); Member member = _memberHandler.GetMemberById(memberId); if (member.InvitedList.Count > 0) { bool matchInvited = false; foreach (var tempList in member.InvitedList) { if (tempList.Key == activityId) { matchInvited = true; } } if (matchInvited) { member.InvitedList.Remove(activityId); await _databaseSystem.UpdateInvitedList(memberId, member.InvitedList); } } return(Json("")); }
public async Task UpdateInvitedListTest() { DatabaseSystem databaseSystem = new DatabaseSystem(); Member member = new Member(); member.MemberId = "unitTest4"; member.MemberName = "zxczxc"; member.Password = "******"; member.Phone = "0326598741"; member.Birthday = "10/10/1659"; member.Sexuality = "女"; Dictionary <string, string> newInvitedList = new Dictionary <string, string>(); newInvitedList.Add("1", "asd123"); await databaseSystem.UpdateMemberInfo(member); var result = await databaseSystem.UpdateInvitedList("unitTest4", newInvitedList); await databaseSystem.Delete("unitTest4", "Member"); Assert.IsTrue(result); }