public static StaffGroupRequest FromResponseData(StaffGroup responseData) { return(StaffGroupRequest.FromResponseType <StaffGroup, StaffGroupRequest>(responseData)); }
public static StaffGroup ToResponseData(StaffGroupRequest requestData) { return(StaffGroupRequest.ToResponseType <StaffGroupRequest, StaffGroup>(requestData)); }
public static StaffGroup ToResponseData(StaffGroupRequest requestData) => ToResponseType <StaffGroupRequest, StaffGroup>(requestData);
public static StaffGroup ToResponseData(StaffGroupRequest requestData) { return StaffGroupRequest.ToResponseType<StaffGroupRequest, StaffGroup>(requestData); }
private static RequestBodyBuilder PopulateRequestParameters(StaffGroupRequest staffGroup, RequestTypes requestType) { staffGroup.EnsureValidData(requestType); RequestBodyBuilder parameters = new RequestBodyBuilder(); if (!String.IsNullOrEmpty(staffGroup.Title)) { parameters.AppendRequestData("title", staffGroup.Title); } parameters.AppendRequestData("isadmin", Convert.ToInt32(staffGroup.IsAdmin)); return parameters; }
/// <summary> /// Update the staff group identified by its internal identifer /// </summary> /// <param name="staffGroup">Data representing the staff group to update. Staff Group Id and Title must be supplied</param> /// <returns></returns> public StaffGroup UpdateStaffGroup(StaffGroupRequest staffGroup) { string apiMethod = String.Format("/Base/StaffGroup/{0}", staffGroup.Id); RequestBodyBuilder parameters = PopulateRequestParameters(staffGroup, RequestTypes.Update); StaffGroupCollection staffGroups = Connector.ExecutePut<StaffGroupCollection>(apiMethod, parameters.ToString()); if (staffGroups != null && staffGroups.Count > 0) { return staffGroups[0]; } return null; }
/// <summary> /// Create a staff group /// </summary> /// <param name="staffGroup">Data representing the staff group to create</param> /// <returns>Data representing the staff group created</returns> public StaffGroup CreateStaffGroup(StaffGroupRequest staffGroup) { string apiMethod = "/Base/StaffGroup"; RequestBodyBuilder parameters = PopulateRequestParameters(staffGroup, RequestTypes.Create); StaffGroupCollection staffGroups = Connector.ExecutePost<StaffGroupCollection>(apiMethod, parameters.ToString()); if (staffGroups != null && staffGroups.Count > 0) { return staffGroups[0]; } return null; }