예제 #1
0
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="BusinessAddressDTO"/> converted from <see cref="BusinessAddress"/>.</param>
 static partial void OnDTO(this BusinessAddress entity, BusinessAddressDTO dto)
 {
     if (entity != null && entity.Address != null)
     {
         dto.Addres = AddressAssembler.ToDTO(entity.Address);
     }
 }
        public BusinessAddressDTO Create(BusinessAddressDTO modelDTO)
        {
            if (modelDTO != null)
            {
                return(BusinessAddressAssembler.ToDTO(businessAddressesRepo.CreateBusinessAddress(BusinessAddressAssembler.ToEntity(modelDTO))));
            }

            return(null);
        }
예제 #3
0
        public BusinessAddressDTO Get(int businessAddressID)
        {
            BusinessAddressDTO oBusinessAddressDTO = null;

            if (businessAddressID > 0)
            {
                BusinessAddress oBusinessAddress = oBusinessAddressesRepo.GetBusinessAddress(businessAddressID);
            }

            return(oBusinessAddressDTO);
        }
        public BusinessAddressDTO Get(int id)
        {
            BusinessAddressDTO businessAddressDTO = null;

            if (id > 0)
            {
                businessAddressDTO = BusinessAddressAssembler.ToDTO(businessAddressesRepo.GetBusinessAddress(id));
            }

            return(businessAddressDTO);
        }
예제 #5
0
        public BusinessAddressDTO Update(BusinessAddressDTO oBusinessAddressDTO)
        {
            BusinessAddressDTO returnAddress = null;

            if (oBusinessAddressDTO != null && oBusinessAddressDTO.AddressID > 0)
            {
                oBusinessAddressesRepo.UpdateBusinessAddress(0, BusinessAddressAssembler.ToEntity(oBusinessAddressDTO));
                returnAddress = oBusinessAddressDTO;
            }

            return(returnAddress);
        }
        public BusinessAddressDTO Update(BusinessAddressDTO modelDTO)
        {
            BusinessAddressDTO returnAddress = null;

            if (modelDTO != null && modelDTO.AddressID > 0)
            {
                businessAddressesRepo.UpdateBusinessAddress(0, BusinessAddressAssembler.ToEntity(modelDTO));
                returnAddress = modelDTO;
            }

            return(returnAddress);
        }
        /// <summary>
        /// Converts this instance of <see cref="BusinessAddress"/> to an instance of <see cref="BusinessAddressDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="BusinessAddress"/> to convert.</param>
        public static BusinessAddressDTO ToDTO(this BusinessAddress entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new BusinessAddressDTO();

            dto.BusinessAddressID = entity.BusinessAddressID;
            dto.BusinessID        = entity.BusinessID;
            dto.AddressID         = entity.AddressID;
            dto.IsPrimary         = entity.IsPrimary;

            entity.OnDTO(dto);

            return(dto);
        }
        /// <summary>
        /// Converts this instance of <see cref="BusinessAddressDTO"/> to an instance of <see cref="BusinessAddress"/>.
        /// </summary>
        /// <param name="dto"><see cref="BusinessAddressDTO"/> to convert.</param>
        public static BusinessAddress ToEntity(this BusinessAddressDTO dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new BusinessAddress();

            entity.BusinessAddressID = dto.BusinessAddressID;
            entity.BusinessID        = dto.BusinessID;
            entity.AddressID         = dto.AddressID;
            entity.IsPrimary         = dto.IsPrimary;

            dto.OnEntity(entity);

            return(entity);
        }
예제 #9
0
        public BussinessDataModel GetBusiness(BusinessDTO businessDTO)
        {
            BussinessDataModel bussinessDataModel = null;

            if (businessDTO != null)
            {
                BusinessAddressDTO BusinessAddressDTO = (businessDTO.BusinessAddresses != null) ? businessDTO.BusinessAddresses.Where(o => o.IsPrimary).FirstOrDefault() : null;
                AddressDTO         oPrimaryAddressDTO = (BusinessAddressDTO != null) ? BusinessAddressDTO.Address : null;

                BusinessPhoneDTO BusinessPhoneDTO = (businessDTO.BusinessPhones != null) ? businessDTO.BusinessPhones.Where(o => o.IsPrimary).FirstOrDefault() : null;
                PhoneDTO         oPrimaryPhoneDTO = (BusinessPhoneDTO != null) ? BusinessPhoneDTO.Phone : null;

                BusinessEmailDTO BusinessEmailDTO = (businessDTO.BusinessEmails != null) ? businessDTO.BusinessEmails.Where(o => o.IsPrimary).FirstOrDefault() : null;
                EmailDTO         oPrimaryEmailDTO = (BusinessEmailDTO != null) ? BusinessEmailDTO.Email : null;

                bussinessDataModel = BussinessDataModelAssembler.ToDataModel(businessDTO, oPrimaryAddressDTO, oPrimaryPhoneDTO, oPrimaryEmailDTO);
                bussinessDataModel.BusinessAddressID = (BusinessAddressDTO != null) ? BusinessAddressDTO.BusinessAddressID : 0;
                bussinessDataModel.BusinessPhoneID   = (BusinessPhoneDTO != null) ? BusinessPhoneDTO.BusinessPhoneID : 0;
                bussinessDataModel.BusinessEmailID   = (BusinessEmailDTO != null) ? BusinessEmailDTO.BusinessEmailID : 0;
            }
            return(bussinessDataModel);
        }
예제 #10
0
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="BusinessAddress"/> converted from <see cref="BusinessAddressDTO"/>.</param>
 static partial void OnEntity(this BusinessAddressDTO dto, BusinessAddress entity)
 {
 }
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="BusinessAddressDTO"/> converted from <see cref="BusinessAddress"/>.</param>
 static partial void OnDTO(this BusinessAddress entity, BusinessAddressDTO dto);