public static HousingViewModel Create(Housing building, bool isAuth) { var model = new HousingViewModel() { Street = building.Street.Name, District = building.District.Name, DistrictId = building.DistrictId, CityId = building.CityId, Phone = isAuth ? (building.Phones.FirstOrDefault()?.Number ?? string.Empty) : (string.Empty), HouseTypeId = building.TypesHousing.Id, HouseType = building.TypesHousing.Name, Price = (int)building.Sum, Description = building.Comment, RentId = building.Id, CityName = building.City.Name }; return model; }
public static HousingViewModel Create(Housing building, bool isAuth) { var model = new HousingViewModel() { Street = building.Street.Name, District = building.District.Name, DistrictId = building.DistrictId, CityId = building.CityId, Phone = isAuth ? (building.Phones.FirstOrDefault()?.Number ?? string.Empty) : (string.Empty), HouseTypeId = building.TypesHousing.Id, HouseType = building.TypesHousing.Name, Price = (int)building.Sum, Description = building.Comment, RentId = building.Id, CityName = building.City.Name }; return(model); }