private string CreateGroup(IGroupsModel model, string groupName, string groupType, IMainPresenter presenter) { string errorMessage = string.Empty; IMemberServices service = new MemberServices(ApplicationResource.BaseUrl, ApplicationResource.ApiVersion); service.CreateGroupUrl = ApplicationResource.ActionCreateGroup; service.UserAgentVersion = ApplicationResource.UserAgent; IServiceResponse response = service.CreateGroup(groupName, groupType, model.AccessToken); if (response.StatusCode == HttpStatusCode.OK) { if (SyncContext != null) { SyncContext.Post(delegate { presenter.UpdateProgressInfo(string.Format("Created group [" + groupName + "]")); }, null); } } if (response.Message.Contains("group_name_already_used")) { if (SyncContext != null) { SyncContext.Post(delegate { presenter.UpdateProgressInfo(ErrorMessages.FAILED_TO_CREATE_GROUP_GROUP_EXISTS); }, null); } } if (response.Message.Contains("group_name_invalid")) { if (SyncContext != null) { SyncContext.Post(delegate { presenter.UpdateProgressInfo(ErrorMessages.FAILED_TO_CREATE_GROUP_GROUP_INVALID); }, null); } } else { errorMessage = ErrorMessages.FAILED_TO_CREATE_GROUP; } return(errorMessage); }
private string CreateGroup(IGroupsModel model, string groupName, IMainPresenter presenter) { string errorMessage = string.Empty; IMemberServices service = new MemberServices(ApplicationResource.BaseUrl, ApplicationResource.ApiVersion); service.CreateGroupUrl = ApplicationResource.ActionCreateGroup; service.UserAgentVersion = ApplicationResource.UserAgent; IServiceResponse response = service.CreateGroup(groupName, model.AccessToken); if (response.StatusCode == HttpStatusCode.OK) { if (SyncContext != null) { SyncContext.Post(delegate { presenter.UpdateProgressInfo(string.Format("Created group [" + groupName + "]")); }, null); } } if (response.Message.Contains("group_name_already_used")) { if (SyncContext != null) { SyncContext.Post(delegate { presenter.UpdateProgressInfo(ErrorMessages.FAILED_TO_CREATE_GROUP_GROUP_EXISTS); }, null); } } if (response.Message.Contains("group_name_invalid")) { if (SyncContext != null) { SyncContext.Post(delegate { presenter.UpdateProgressInfo(ErrorMessages.FAILED_TO_CREATE_GROUP_GROUP_INVALID); }, null); } } else { errorMessage = ErrorMessages.FAILED_TO_CREATE_GROUP; } return errorMessage; }