public PropertiesSearchViewModel(PropertiesSearchViewModel psvm) { this.RentFrom = psvm.RentFrom; this.RentTo = psvm.RentTo; this.SellFrom = psvm.SellFrom; this.SellTo = psvm.SellTo; this.SizeFrom = psvm.SizeFrom; this.SizeTo = psvm.SizeTo; this.City = psvm.City; this.Region = psvm.Region; if (psvm.PropType != null) { psvm.PropType.Concat(this.PropType); } if (psvm.Features != null) { psvm.Features.Concat(this.Features); } }
public PropertiesSearchViewModel StringToPSVM(string propType, string Features , int RentFrom = 0, int RentTo = 0, int SellFrom = 0, int SellTo = 0, int SizeFrom = 0, int SizeTo = 0, int City = 0, int Region = 0) { var prType = propType != null?propType.Split(',') : new string[1] { "" }; var fts = Features != null?Features.Split(',') : new string[1] { "" }; PropertiesSearchViewModel PSVM = new PropertiesSearchViewModel(); foreach (var item in prType) { if (!string.IsNullOrEmpty(item)) { this.PropType.Add(int.Parse(item)); } } foreach (var item in fts) { if (!string.IsNullOrEmpty(item)) { this.Features.Add(int.Parse(item)); } } this.RentFrom = RentFrom; this.RentTo = RentTo; this.SellFrom = SellFrom; this.SellTo = SellTo; this.SizeFrom = SizeFrom; this.SizeTo = SizeTo; this.City = City; this.Region = Region; return(this); }