示例#1
0
        public virtual async Task <T> GetByIdAsync(string id)
        {
            using (var client = await OdataContext.GetHttpClientAsync())
            {
                var result = await client.GetStringAsync((RepoEndpointConfig.GetSingleItemEndpoint(id)));

                return(JsonConvert.DeserializeObject <T>(result));
            }
        }
示例#2
0
        public virtual async Task <T> AddAsync(T entity)
        {
            var endpoint    = RepoEndpointConfig.GetPostEndpoint();
            var jsonContent = await OdataContext.PostAsync(endpoint, entity);

            var addedEntity = JsonConvert.DeserializeObject <T>(jsonContent);

            return(addedEntity);
        }
示例#3
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (OdataContext != null)
         {
             hashCode = hashCode * 59 + OdataContext.GetHashCode();
         }
         if (AccessRights != null)
         {
             hashCode = hashCode * 59 + AccessRights.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#4
0
        public virtual async Task <IEnumerable <T> > GetAllAsync(bool shouldAudit = true)
        {
            bool     hasNextPage          = false;
            Uri      nextPage             = RepoEndpointConfig.GetAllItemsEndpoint();
            List <T> sitefinitySocMapping = new List <T>();

            do
            {
                var result = await OdataContext.GetResult(nextPage, shouldAudit);

                sitefinitySocMapping.AddRange(result.Value);
                hasNextPage = result.HasNextPage;
                if (hasNextPage)
                {
                    nextPage = new Uri(result.NextLink);
                }
            } while (hasNextPage);

            return(sitefinitySocMapping);
        }
示例#5
0
        /// <summary>
        /// Returns true if InlineResponseDefault4 instances are equal
        /// </summary>
        /// <param name="other">Instance of InlineResponseDefault4 to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InlineResponseDefault4 other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     OdataContext == other.OdataContext ||
                     OdataContext != null &&
                     OdataContext.Equals(other.OdataContext)
                     ) &&
                 (
                     AccessRights == other.AccessRights ||
                     AccessRights != null &&
                     AccessRights.Equals(other.AccessRights)
                 ));
        }
        /// <summary>
        /// Returns true if InlineResponseDefault2 instances are equal
        /// </summary>
        /// <param name="other">Instance of InlineResponseDefault2 to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InlineResponseDefault2 other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     OdataContext == other.OdataContext ||
                     OdataContext != null &&
                     OdataContext.Equals(other.OdataContext)
                     ) &&
                 (
                     Value == other.Value ||
                     Value != null &&
                     Value.SequenceEqual(other.Value)
                 ));
        }
示例#7
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (OdataContext != null)
         {
             hashCode = hashCode * 59 + OdataContext.GetHashCode();
         }
         if (OdataType != null)
         {
             hashCode = hashCode * 59 + OdataType.GetHashCode();
         }
         if (ParentOptionSetName != null)
         {
             hashCode = hashCode * 59 + ParentOptionSetName.GetHashCode();
         }
         if (IsCustomOptionSet != null)
         {
             hashCode = hashCode * 59 + IsCustomOptionSet.GetHashCode();
         }
         if (IsGlobal != null)
         {
             hashCode = hashCode * 59 + IsGlobal.GetHashCode();
         }
         if (IsManaged != null)
         {
             hashCode = hashCode * 59 + IsManaged.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (ExternalTypeName != null)
         {
             hashCode = hashCode * 59 + ExternalTypeName.GetHashCode();
         }
         if (OptionSetType != null)
         {
             hashCode = hashCode * 59 + OptionSetType.GetHashCode();
         }
         if (IntroducedVersion != null)
         {
             hashCode = hashCode * 59 + IntroducedVersion.GetHashCode();
         }
         if (MetadataId != null)
         {
             hashCode = hashCode * 59 + MetadataId.GetHashCode();
         }
         if (HasChanged != null)
         {
             hashCode = hashCode * 59 + HasChanged.GetHashCode();
         }
         if (Options != null)
         {
             hashCode = hashCode * 59 + Options.GetHashCode();
         }
         if (Description != null)
         {
             hashCode = hashCode * 59 + Description.GetHashCode();
         }
         if (DisplayName != null)
         {
             hashCode = hashCode * 59 + DisplayName.GetHashCode();
         }
         if (IsCustomizable != null)
         {
             hashCode = hashCode * 59 + IsCustomizable.GetHashCode();
         }
         return(hashCode);
     }
 }
示例#8
0
        /// <summary>
        /// Returns true if InlineResponseDefault7 instances are equal
        /// </summary>
        /// <param name="other">Instance of InlineResponseDefault7 to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InlineResponseDefault7 other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     OdataContext == other.OdataContext ||
                     OdataContext != null &&
                     OdataContext.Equals(other.OdataContext)
                     ) &&
                 (
                     OdataType == other.OdataType ||
                     OdataType != null &&
                     OdataType.Equals(other.OdataType)
                 ) &&
                 (
                     ParentOptionSetName == other.ParentOptionSetName ||
                     ParentOptionSetName != null &&
                     ParentOptionSetName.Equals(other.ParentOptionSetName)
                 ) &&
                 (
                     IsCustomOptionSet == other.IsCustomOptionSet ||
                     IsCustomOptionSet != null &&
                     IsCustomOptionSet.Equals(other.IsCustomOptionSet)
                 ) &&
                 (
                     IsGlobal == other.IsGlobal ||
                     IsGlobal != null &&
                     IsGlobal.Equals(other.IsGlobal)
                 ) &&
                 (
                     IsManaged == other.IsManaged ||
                     IsManaged != null &&
                     IsManaged.Equals(other.IsManaged)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     ExternalTypeName == other.ExternalTypeName ||
                     ExternalTypeName != null &&
                     ExternalTypeName.Equals(other.ExternalTypeName)
                 ) &&
                 (
                     OptionSetType == other.OptionSetType ||
                     OptionSetType != null &&
                     OptionSetType.Equals(other.OptionSetType)
                 ) &&
                 (
                     IntroducedVersion == other.IntroducedVersion ||
                     IntroducedVersion != null &&
                     IntroducedVersion.Equals(other.IntroducedVersion)
                 ) &&
                 (
                     MetadataId == other.MetadataId ||
                     MetadataId != null &&
                     MetadataId.Equals(other.MetadataId)
                 ) &&
                 (
                     HasChanged == other.HasChanged ||
                     HasChanged != null &&
                     HasChanged.Equals(other.HasChanged)
                 ) &&
                 (
                     Options == other.Options ||
                     Options != null &&
                     Options.SequenceEqual(other.Options)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     DisplayName == other.DisplayName ||
                     DisplayName != null &&
                     DisplayName.Equals(other.DisplayName)
                 ) &&
                 (
                     IsCustomizable == other.IsCustomizable ||
                     IsCustomizable != null &&
                     IsCustomizable.Equals(other.IsCustomizable)
                 ));
        }
 public async Task DeleteByIdAsync(Guid Id)
 {
     await OdataContext.DeleteAsync(base.RepoEndpointConfig.GetSingleItemEndpoint(Id.ToString()));
 }
 public override async Task DeleteAsync(SfApprenticeshipVacancy entity)
 {
     await OdataContext.DeleteAsync(base.RepoEndpointConfig.GetSingleItemEndpoint(entity.Id.ToString()));
 }
 public async Task AddRelatedAsync(string addedVacancyId, Guid socCodeId)
 {
     var relatedSocLink = $"{{\"@odata.id\":  \"{socEndpointConfig.GetSingleItemEndpoint(socCodeId.ToString())}\"}}";
     await OdataContext.PutAsync(base.RepoEndpointConfig.GetReferenceEndpoint(addedVacancyId, "SOCCode"), relatedSocLink);
 }
 public async Task UnlockAndPublishAsync(string addedVacancyId)
 {
     var body = $"{{\"action\": \"Publish\", \"actionParameters\": {{}} }}";
     await OdataContext.PutAsync(base.RepoEndpointConfig.GetPublishEndpoint(addedVacancyId), body);
 }