Exemple #1
0
        public override int GetHashCode()
        {
            int hashCode =
                IdVer.GetHashCode() +
                IdSubVer.GetHashCode() +
                Timestamp.GetHashCode() +
                (IdPrototype == null ? 0 : IdPrototype.GetHashCode()) +
                (IdItemBcn == null ? 0 : IdItemBcn.GetHashCode()) +
                (IdMatTypeL1 == null ? 0 : IdMatTypeL1.GetHashCode()) +
                (IdMatTypeL2 == null ? 0 : IdMatTypeL2.GetHashCode()) +
                (IdMatTypeL3 == null ? 0 : IdMatTypeL3.GetHashCode()) +
                (IdDefaultSupplier == null ? 0 : IdDefaultSupplier.GetHashCode()) +
                (IdModel == null ? 0 : IdModel.GetHashCode()) +
                (IdFamilyHK == null ? 0 : IdFamilyHK.GetHashCode()) +
                (IdColor1 == null ? 0 : IdColor1.GetHashCode()) +
                (IdColor2 == null ? 0 : IdColor2.GetHashCode()) +
                (IdItemHK == null ? 0 : IdItemHK.GetHashCode()) +
                (ItemDescription == null ? 0 : ItemDescription.GetHashCode()) +
                (Comments == null ? 0 : Comments.GetHashCode()) +
                (LaunchDate == null ? 0 : LaunchDate.GetHashCode()) +
                (RemovalDate == null ? 0 : RemovalDate.GetHashCode()) +
                IdStatusCial.GetHashCode() +
                IdStatusProd.GetHashCode() +
                (IdUserAttri1 == null ? 0 : IdUserAttri1.GetHashCode()) +
                (IdUserAttri2 == null ? 0 : IdUserAttri2.GetHashCode()) +
                (IdUserAttri3 == null ? 0 : IdUserAttri3.GetHashCode()) +
                (Unit == null ? 0 : Unit.GetHashCode()) +
                (DocsLink == null ? 0 : DocsLink.GetHashCode()) +
                CreateDate.GetHashCode() +
                (PhotoUrl == null ? 0 : PhotoUrl.GetHashCode()) +
                (User == null ? 0 : User.GetHashCode());

            return(hashCode);
        }
        public async Task <Result> AddProductPhotoAsync(Stream stream, Guid productId, string fileName)
        {
            var result = await _filesManager
                         .UploadPhoto(stream, fileName)
                         .ConfigureAwait(false);

            if (!result.Succeeded)
            {
                return(Result.Failure(result.Errors));
            }

            var photo = new PhotoUrl
            {
                ProductId = productId,
                Files     = new Entities.Models.Files {
                    Url = result.Data
                }
            };

            await Data.PhotoUrl.AddAsync(photo)
            .ConfigureAwait(false);

            await Data.SaveChangesAsync()
            .ConfigureAwait(false);

            return(Result.Success);
        }
Exemple #3
0
        public void UpdatePhotoUrlShouldSetUrl()
        {
            //Act
            this._player !.UpdatePhotoUrl("https://valid.url");

            //Assert
            this._player !.PhotoUrl
            .Should()
            .Be("https://valid.url");
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (PhotoUrl != null ? PhotoUrl.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ProfileUrl != null ? ProfileUrl.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LoginProvider != null ? LoginProvider.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ IsSelf.GetHashCode();
         return(hashCode);
     }
 }
Exemple #5
0
        public Hotel CreateHotel()
        {
            var result = new Hotel();

            result.Name         = this.Name;
            result.Stars        = this.Stars;
            result.Address      = this.Address;
            result.City         = new City();
            result.City.Name    = this.CityName;
            result.Country      = new Country();
            result.Country.Name = this.CountryName;
            result.Zip          = this.Zip;
            result.Rooms        = new HashSet <Room>();
            // TODO: to fix rooms
            result.PhotoUrls = new HashSet <PhotoUrl>();
            bool photosEmpty     = this.PhotoUrls == null || this.PhotoUrls.Count == 0;
            bool firstPhotoEmpty = this.FirstPhotoUrl == null || this.FirstPhotoUrl == String.Empty;

            if (!photosEmpty)
            {
                foreach (var photo in this.PhotoUrls)
                {
                    var photoUrl = new PhotoUrl();
                    photoUrl.Url = photo;
                    result.PhotoUrls.Add(photoUrl);
                }
            }
            result.FirstPhotoUrl = this.FirstPhotoUrl;  //TODO!

            result.HasInternet   = this.HasInternet;
            result.HasParking    = this.HasParking;
            result.HasRestaurant = this.HasRestaurant;
            result.User          = new User();
            result.User.Id       = this.UserId;

            return(result);
        }