Inheritance: Nop.Core.BaseEntity
Exemplo n.º 1
0
        public static ExtendedVendorModel ToModel(this Domain.ExtendedVendor ExtendedVendor)
        {
            var model = new ExtendedVendorModel()
            {
                AddressLine1       = ExtendedVendor.AddressLine1,
                AddressLine2       = ExtendedVendor.AddressLine2,
                City               = ExtendedVendor.City,
                CountryId          = ExtendedVendor.CountryId,
                HelpfulnessEnabled = ExtendedVendor.HelpfulnessEnabled,
                LogoId             = ExtendedVendor.LogoId,
                ReviewsEnabled     = ExtendedVendor.ReviewsEnabled,
                StateProvinceId    = ExtendedVendor.StateProvinceId,
                VendorId           = ExtendedVendor.VendorId,
                TinNumber          = ExtendedVendor.TinNumber,
                ServiceTaxNumber   = ExtendedVendor.ServiceTaxNumber,
                ShortCode          = ExtendedVendor.ShortCode,
                VatCST             = ExtendedVendor.VatCST,
                Id                   = ExtendedVendor.Id,
                ZipCode              = ExtendedVendor.ZipCode,
                PhoneNumber          = ExtendedVendor.PhoneNumber,
                CommissionPercentage = ExtendedVendor.CommissionPercentage
            };

            return(model);
        }
Exemplo n.º 2
0
        public static ExtendedVendorListModel ToListModel(this Domain.ExtendedVendor ExtendedVendor, IPictureService _pictureService, ICacheManager _cacheManager, ICountryService _countryService, IStateProvinceService _stateProvinceService)
        {
            var model = new ExtendedVendorListModel()
            {
                AddressLine1       = ExtendedVendor.AddressLine1,
                AddressLine2       = ExtendedVendor.AddressLine2,
                City               = ExtendedVendor.City,
                CountryId          = ExtendedVendor.CountryId,
                HelpfulnessEnabled = ExtendedVendor.HelpfulnessEnabled,
                LogoId             = ExtendedVendor.LogoId,
                ReviewsEnabled     = ExtendedVendor.ReviewsEnabled,
                StateProvinceId    = ExtendedVendor.StateProvinceId,
                VendorId           = ExtendedVendor.VendorId,
                TINNumber          = ExtendedVendor.TinNumber,
                ServiceTaxNumber   = ExtendedVendor.ServiceTaxNumber,
                ShortCode          = ExtendedVendor.ShortCode,
                VatCST             = ExtendedVendor.VatCST,
                Id                   = ExtendedVendor.Id,
                ZipCode              = ExtendedVendor.ZipCode,
                PhoneNumber          = ExtendedVendor.PhoneNumber,
                CommissionPercentage = ExtendedVendor.CommissionPercentage
            };
            var countries = _countryService.GetAllCountries();

            foreach (var country in countries)
            {
                var listItem = new SelectListItem
                {
                    Text  = country.Name,
                    Value = country.Id.ToString()
                };
                if (country.Id == model.CountryId)
                {
                    listItem.Selected = true;
                }

                model.SelectedCountry.Add(listItem);
            }
            if (model.CountryId != 0)
            {
                var states = _stateProvinceService.GetStateProvincesByCountryId(model.CountryId);
                foreach (var state in states)
                {
                    var listItem = new SelectListItem
                    {
                        Text  = state.Name,
                        Value = state.Id.ToString()
                    };
                    if (state.Id == model.StateProvinceId)
                    {
                        listItem.Selected = true;
                    }
                    model.SelectedStateProvince.Add(listItem);
                }
            }

            return(model);
        }