Esempio n. 1
0
        public SearchAllViewModel(SearchAllViewModel model,
                                  bool?isForRent    = null, bool?isShortPeriodRent = null,
                                  DateTime?from     = null, DateTime?to            = null,
                                  int?priceFrom     = null, int?priceTo            = null,
                                  int?propertyType  = null,
                                  int?areaFrom      = null, int?areaTo           = null,
                                  int?cityId        = null, int?distanceFromCity = null,
                                  List <int> extras = null,
                                  int?pageCount     = 1, int?pageSize    = null,
                                  string sortBy     = "", string orderBy = "",
                                  string viewType   = "")
        {
            this.IsForRent = isForRent ?? model.IsForRent;

            this.From = from ?? model.From;
            this.To   = to ?? model.To;
            this.IsShortPeriodRent = isShortPeriodRent ?? model.IsShortPeriodRent;

            this.PropertyType     = propertyType == -1 ? null : propertyType ?? model.PropertyType;
            this.AreaFrom         = areaFrom == -1 ? null : areaFrom ?? model.AreaFrom;
            this.AreaTo           = areaTo == -1 ? null : areaTo ?? model.AreaTo;
            this.PriceFrom        = priceFrom == -1 ? null : priceFrom ?? model.PriceFrom;
            this.PriceTo          = priceTo == -1 ? null : priceTo ?? model.PriceTo;
            this.CityId           = cityId == -1 ? null : cityId ?? model.CityId;
            this.DistanceFromCity = distanceFromCity == -1 ? null : distanceFromCity ?? model.DistanceFromCity;
            this.PageCount        = pageCount ?? model.PageCount;
            this.PageSize         = pageSize ?? model.PageSize;
            this.SortBy           = !string.IsNullOrEmpty(sortBy) ? sortBy : model.SortBy;
            this.OrderBy          = !string.IsNullOrEmpty(orderBy) ? orderBy : model.OrderBy;
            this.ViewType         = !string.IsNullOrEmpty(viewType) ? viewType : model.ViewType;

            this.Extras = extras ?? model.Extras;
        }
Esempio n. 2
0
 public SearchMapViewModel(SearchAllViewModel model)
 {
     this.PropertyType     = model.PropertyType;
     this.AreaFrom         = model.AreaFrom;
     this.AreaTo           = model.AreaTo;
     this.PriceFrom        = model.PriceFrom;
     this.PriceTo          = model.PriceTo;
     this.CityId           = model.CityId;
     this.DistanceFromCity = model.DistanceFromCity;
     this.IsForRent        = model.IsForRent;
     this.From             = model.From;
     this.To = model.To;
     this.IsShortPeriodRent = model.IsShortPeriodRent;
     this.Extras            = model.Extras;
 }