public BusinessDataModel Get(BusinessDTO modelDTO)
        {
            BusinessDataModel BusinessDataModel = null;

            if (modelDTO != null)
            {
                //List<BusinessAddressDTO> BusinessAddressDTO = (modelDTO.BusinessAddresses != null) ? modelDTO.BusinessAddresses.Select(p => p) : null;
                //AddressDTO oPrimaryAddressDTO = (BusinessAddressDTO != null) ? BusinessAddressDTO.Addres : null;

                List <AddressDTO>     oPrimaryAddressDTO     = (modelDTO.BusinessAddresses != null) ? modelDTO.BusinessAddresses.Where(p => p.BusinessID == modelDTO.BusinessID).Select(p => p.Addres).ToList() : null;
                List <ServiceDTO>     servicesList           = (modelDTO.Services != null) ? modelDTO.Services.Where(p => p.BusinessID == modelDTO.BusinessID).ToList() : null;
                List <AchievementDTO> oPrimaryAchievementDTO = (modelDTO.Achievements != null) ? modelDTO.Achievements.Where(p => p.BusinessID == modelDTO.BusinessID).Select(p => p).ToList() : null;

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

                //BusinessImageDTO BusinessImageDTO = (modelDTO.BusinessImages != null) ? modelDTO.BusinessImages.Where(o => o.IsPrimary).FirstOrDefault() : null;
                //ImageDTO oPrimaryImageDTO = (BusinessImageDTO != null) ? BusinessImageDTO.Image : null;

                ImageDTO oPrimaryImageDTO = (modelDTO.BusinessImages != null) ? modelDTO.BusinessImages.Where(o => o.IsPrimary).Select(p => p.Image).FirstOrDefault() : null;

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

                BusinessDataModel = BusinessDataModelAssembler.ToDataModel(modelDTO, oPrimaryAddressDTO, oPrimaryPhoneDTO, oPrimaryEmailDTO, oPrimaryImageDTO, oPrimaryAchievementDTO, null, servicesList);
                BusinessDataModel.PrimaryAddressID = (modelDTO.BusinessAddresses != null) ? modelDTO.BusinessAddresses.FirstOrDefault(p => p.IsPrimary == true).AddressID : 0;
                //BusinessDataModel.BusinessAddressID = (BusinessAddressDTO != null) ? BusinessAddressDTO.BusinessAddressID : 0;
                BusinessDataModel.BusinessPhoneID = (BusinessPhoneDTO != null) ? BusinessPhoneDTO.BusinessPhoneID : 0;
                BusinessDataModel.BusinessEmailID = (BusinessEmailDTO != null) ? BusinessEmailDTO.BusinessEmailID : 0;
            }
            return(BusinessDataModel);
        }
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="UserPhoneDTO"/> converted from <see cref="UserPhone"/>.</param>
 static partial void OnDTO(this BusinessPhone entity, BusinessPhoneDTO dto)
 {
     if (entity != null && entity.Phone != null)
     {
         dto.Phone = PhoneAssembler.ToDTO(entity.Phone);
     }
 }
        public BusinessPhoneDTO Create(BusinessPhoneDTO modelDTO)
        {
            if (modelDTO != null)
            {
                return(BusinessPhoneAssembler.ToDTO(businessPhoneRepos.CreateBusinessPhone(BusinessPhoneAssembler.ToEntity(modelDTO))));
            }

            return(null);
        }
Пример #4
0
        public BusinessPhoneDTO Get(int businessPhoneID)
        {
            BusinessPhoneDTO oBusinessPhoneDTO = null;

            if (businessPhoneID > 0)
            {
                BusinessPhone oBusinessPhone = oBusinessPhoneRepos.GetBusinessPhone(businessPhoneID);
            }

            return(oBusinessPhoneDTO);
        }
        public BusinessPhoneDTO Get(int id)
        {
            BusinessPhoneDTO oBusinessPhoneDTO = null;

            if (id > 0)
            {
                BusinessPhone oBusinessPhone = businessPhoneRepos.GetBusinessPhone(id);
            }

            return(oBusinessPhoneDTO);
        }
Пример #6
0
        public BusinessPhoneDTO Update(BusinessPhoneDTO oBusinessPhoneDTO)
        {
            BusinessPhoneDTO returnPhone = null;

            if (oBusinessPhoneDTO != null && oBusinessPhoneDTO.PhoneID > 0)
            {
                oBusinessPhoneRepos.UpdateBusinessPhone(0, BusinessPhoneAssembler.ToEntity(oBusinessPhoneDTO));
                returnPhone = oBusinessPhoneDTO;
            }

            return(returnPhone);
        }
        public BusinessPhoneDTO Update(BusinessPhoneDTO modelDTO)
        {
            BusinessPhoneDTO returnPhone = null;

            if (modelDTO != null && modelDTO.PhoneID > 0)
            {
                businessPhoneRepos.UpdateBusinessPhone(0, BusinessPhoneAssembler.ToEntity(modelDTO));
                returnPhone = modelDTO;
            }

            return(returnPhone);
        }
Пример #8
0
        /// <summary>
        /// Converts this instance of <see cref="BusinessPhone"/> to an instance of <see cref="BusinessPhoneDTO"/>.
        /// </summary>
        /// <param name="entity"><see cref="BusinessPhone"/> to convert.</param>
        public static BusinessPhoneDTO ToDTO(this BusinessPhone entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new BusinessPhoneDTO();

            dto.BusinessPhoneID = entity.BusinessPhoneID;
            dto.BusinessID      = entity.BusinessID;
            dto.PhoneID         = entity.PhoneID;
            dto.IsPrimary       = entity.IsPrimary;

            entity.OnDTO(dto);

            return(dto);
        }
Пример #9
0
        /// <summary>
        /// Converts this instance of <see cref="BusinessPhoneDTO"/> to an instance of <see cref="BusinessPhone"/>.
        /// </summary>
        /// <param name="dto"><see cref="BusinessPhoneDTO"/> to convert.</param>
        public static BusinessPhone ToEntity(this BusinessPhoneDTO dto)
        {
            if (dto == null)
            {
                return(null);
            }

            var entity = new BusinessPhone();

            entity.BusinessPhoneID = dto.BusinessPhoneID;
            entity.BusinessID      = dto.BusinessID;
            entity.PhoneID         = dto.PhoneID;
            entity.IsPrimary       = dto.IsPrimary;

            dto.OnEntity(entity);

            return(entity);
        }
Пример #10
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);
        }
Пример #11
0
 /// <summary>
 /// Invoked when <see cref="ToEntity"/> operation is about to return.
 /// </summary>
 /// <param name="entity"><see cref="BusinessPhone"/> converted from <see cref="BusinessPhoneDTO"/>.</param>
 static partial void OnEntity(this BusinessPhoneDTO dto, BusinessPhone entity);
Пример #12
0
 /// <summary>
 /// Invoked when <see cref="ToDTO"/> operation is about to return.
 /// </summary>
 /// <param name="dto"><see cref="BusinessPhoneDTO"/> converted from <see cref="BusinessPhone"/>.</param>
 static partial void OnDTO(this BusinessPhone entity, BusinessPhoneDTO dto);