private string AddMemberGroup(IGroupsModel model, string email, IMainPresenter presenter) { string errorMessage = string.Empty; IMemberServices service = new MemberServices(ApplicationResource.BaseUrl, ApplicationResource.ApiVersion); service.AddMemberGroupUrl = ApplicationResource.ActionAddMemberGroup; service.UserAgentVersion = ApplicationResource.UserAgent; foreach (GroupListViewItemModel item in model.Groups.Where(m => m.IsChecked).ToList()) { IServiceResponse response = service.AddMemberGroup(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("Added user [" + email + "] to group [" + item.GroupName + "]")); }, null); } } else { errorMessage = ErrorMessages.FAILED_TO_ADD_MEMBER_TO_GROUP; } } return(errorMessage); }
private string AddMemberGroup(IGroupsModel model, string email, IMainPresenter presenter) { string errorMessage = string.Empty; IMemberServices service = new MemberServices(ApplicationResource.BaseUrl, ApplicationResource.ApiVersion); service.AddMemberGroupUrl = ApplicationResource.ActionAddMemberGroup; service.UserAgentVersion = ApplicationResource.UserAgent; foreach (GroupListViewItemModel item in model.Groups.Where(m => m.IsChecked).ToList()) { IServiceResponse response = service.AddMemberGroup(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("Added user [" + email + "] to group [" + item.GroupName + "]")); }, null); } } else { errorMessage = ErrorMessages.FAILED_TO_ADD_MEMBER_TO_GROUP; } } return errorMessage; }