private string DeleteMemberGroup(IGroupsModel model, string email, IMainPresenter presenter) { string errorMessage = string.Empty; IMemberServices service = new MemberServices(ApplicationResource.BaseUrl, ApplicationResource.ApiVersion); service.DeleteMemberGroupUrl = ApplicationResource.ActionDeleteMemberGroup; service.UserAgentVersion = ApplicationResource.UserAgent; foreach (GroupListViewItemModel item in model.Groups.Where(m => m.IsChecked).ToList()) { IServiceResponse response = service.DeleteMemberGroup(new MemberData() { GroupId = item.GroupId, GroupName = item.GroupName }, email, model.AccessToken); if (response.StatusCode == HttpStatusCode.OK) { if (SyncContext != null) { SyncContext.Post(delegate { presenter.UpdateProgressInfo(string.Format("Deleted user [" + email + "] from group [" + item.GroupName + "]")); }, null); } } else { errorMessage = ErrorMessages.FAILED_TO_DELETE_MEMBER_FROM_GROUP; } } return(errorMessage); }
private string DeleteMemberGroup(IGroupsModel model, string email, IMainPresenter presenter) { string errorMessage = string.Empty; IMemberServices service = new MemberServices(ApplicationResource.BaseUrl, ApplicationResource.ApiVersion); service.DeleteMemberGroupUrl = ApplicationResource.ActionDeleteMemberGroup; service.UserAgentVersion = ApplicationResource.UserAgent; foreach (GroupListViewItemModel item in model.Groups.Where(m => m.IsChecked).ToList()) { IServiceResponse response = service.DeleteMemberGroup(new MemberData() { GroupId = item.GroupId, GroupName = item.GroupName }, email, model.AccessToken); if (response.StatusCode == HttpStatusCode.OK) { if (SyncContext != null) { SyncContext.Post(delegate { presenter.UpdateProgressInfo(string.Format("Deleted user [" + email + "] from group [" + item.GroupName + "]")); }, null); } } else { errorMessage = ErrorMessages.FAILED_TO_DELETE_MEMBER_FROM_GROUP; } } return errorMessage; }