コード例 #1
0
        public static MakerSpace UpdateMakerSpace(this MakerSpace makerSpace, UpdateMakerSpace request)
        {
            if (!string.IsNullOrWhiteSpace(request.Name))
            {
                makerSpace.Name = request.Name;
            }
            if (!string.IsNullOrWhiteSpace(request.WorkShopType))
            {
                makerSpace.WorkShopType = request.WorkShopType;
            }
            if (!string.IsNullOrWhiteSpace(request.AssociatedSchool))
            {
                makerSpace.AssociatedSchool = request.AssociatedSchool;
            }
            if (!string.IsNullOrWhiteSpace(request.Description))
            {
                makerSpace.Description = request.Description;
            }
            if (!(request.Logo is null))
            {
                makerSpace.Logo = request.Logo;
            }
            if (!(request.AccessType == AccessType.None))
            {
                makerSpace.AccessType = request.AccessType;
            }
            if (!string.IsNullOrWhiteSpace(request.Organization))
            {
                makerSpace.Organization = request.Organization;
            }
            if (!string.IsNullOrWhiteSpace(request.VATNumber))
            {
                makerSpace.VATNumber = request.VATNumber;
            }
            if (!string.IsNullOrWhiteSpace(request.Phone) && !string.IsNullOrWhiteSpace(request.Email))
            {
                makerSpace.ContactInfo = new ContactInfo {
                    Phone = request.Phone, Email = request.Email
                };
            }
            makerSpace.Address = CreateNewValidAddress(makerSpace.Address, request);

            return(makerSpace);
        }
コード例 #2
0
 private static Address CreateNewValidAddress(Address current, UpdateMakerSpace request)
 {
     if (string.IsNullOrWhiteSpace(request.Street))
     {
         request.Street = current.Street;
     }
     if (string.IsNullOrWhiteSpace(request.City))
     {
         request.City = current.City;
     }
     if (string.IsNullOrWhiteSpace(request.PostCode))
     {
         request.PostCode = current.PostCode;
     }
     if (string.IsNullOrWhiteSpace(request.Country))
     {
         request.Country = current.Country;
     }
     return(new Address(request.Street, request.Country, request.Country, request.PostCode));
 }