public async Task <IActionResult> Properties(PropertySearchModel model) { var results = await _propertyDetailService.searchPropertyDetails(model); PropertyModel propertyModel = new PropertyModel(); List <PropertyDetailViewModel> details = new List <PropertyDetailViewModel>(); foreach (var item in results) { var propDetails = new PropertyDetailViewModel { Image = Convert.ToBase64String(item.PropertyImage?.FirstOrDefault().Image), Id = item.Id, NumOfbathrooms = item.NumOfbathrooms, NumOfBedrooms = item.NumOfBedrooms, LandSize = item.LandSize, NumOfGarages = item.NumOfGarages, NumOfKitchens = item.NumOfKitchens, NumOfParkingSpots = item.NumOfParkingSpots, NumOfReceptionRooms = item.NumOfReceptionRooms, PropertyAddress = item.PropertyAddress, PropertyDesc = item.PropertyDesc }; details.Add(propDetails); } propertyModel.PropertyDetails = details; propertyModel.propertySearch = new PropertySearchModel(); return(View(propertyModel)); }
public SummaryPage(PropertyDetailViewModel viewModel) { var vm = new SummaryViewModel(viewModel); BindingContext = this.viewModel = vm; InitializeComponent(); }
public MPRNDetailPage(PropertyModel viewModel) { var vm = new PropertyDetailViewModel(viewModel); // vm.LoadItemsCommand.Execute(null); // vm.PropertyModel = viewModel.PropertyModel; // vm = viewModel; this.BindingContext = this.viewModel = vm; InitializeComponent(); }
public ActionResult PropertyDetail(PropertyDetailViewModel propertyDetail) { var imagesOne = SaveImgae(propertyDetail.ImageUploadOne); var imagesTwo = SaveImgae(propertyDetail.ImageUploadTwo); var imagesThree = SaveImgae(propertyDetail.ImageUploadThree); var data = new Kalyan.Property.Infrastructure.Models.PropertyDetail() { IsActive = false, Approved = false, CountryId = propertyDetail.SelectedCountryId, StateId = propertyDetail.SelectedStateId, CityId = propertyDetail.SelectedCityId, AreaId = propertyDetail.SelectedAreaId, PropertyName = propertyDetail.PropertyName, PropertyDescription = propertyDetail.PropertyDescription, FullName = propertyDetail.FullName, Phone = propertyDetail.Phone, Email = propertyDetail.Email, Comments = propertyDetail.Comments, Date = DateTime.Now, Bathroom = propertyDetail.SelectedBathtId, Bedroom = propertyDetail.SelectedBedtId, UserId = User.Identity.GetUserId <int>(), FromPrice = Convert.ToString(propertyDetail.Price), Parking = "2", ContractType = iUnitOfWork.Repository <ContractType>().Get(x => x.Id == propertyDetail.SelectedContractId).Name, PropertyImages = new List <PropertyImage>() { new PropertyImage { ImagePath = imagesOne, IsActive = true }, new PropertyImage { ImagePath = imagesTwo, IsActive = true }, new PropertyImage { ImagePath = imagesThree, IsActive = true }, } , PropertyAmenityMappings = propertyDetail.Amenity.Where(x => x.Selected == true).Select(x => new PropertyAmenityMapping() { AmenityId = Convert.ToInt32(x.Value) }).ToList() }; iUnitOfWork.Repository <PropertyDetail>().Add(data); iUnitOfWork.Commit(); PropertyDetailViewModel viewModel = GetPropertyDetailViewModel(); ModelState.Clear(); return(View(viewModel)); }
public async Task <IActionResult> PropertyDetails(int Id) { var results = await _propertyDetailService.getPropertyDetails(Id); var propertyDetails = new PropertyDetailViewModel { Image = Convert.ToBase64String(results.PropertyImage?.FirstOrDefault().Image), Id = results.Id, NumOfbathrooms = results.NumOfbathrooms, NumOfBedrooms = results.NumOfBedrooms, LandSize = results.LandSize, NumOfGarages = results.NumOfGarages, NumOfKitchens = results.NumOfKitchens, NumOfParkingSpots = results.NumOfParkingSpots, NumOfReceptionRooms = results.NumOfReceptionRooms, PropertyAddress = results.PropertyAddress, PropertyDesc = results.PropertyDesc };; return(View(propertyDetails)); }
private PropertyDetailViewModel GetPropertyDetailViewModel() { var country = iUnitOfWork.Repository <Country>().GetAll().Select(x => new SelectListItem { Text = x.Name, Value = Convert.ToString(x.Id) }); var state = iUnitOfWork.Repository <State>().GetAll().Select(x => new SelectListItem { Text = x.Name, Value = Convert.ToString(x.Id) }); var city = iUnitOfWork.Repository <City>().GetAll().Select(x => new SelectListItem { Text = x.Name, Value = Convert.ToString(x.Id) }); var area = iUnitOfWork.Repository <Area>().GetAll().Select(x => new SelectListItem { Text = x.Name, Value = Convert.ToString(x.Id) }); var propertyType = iUnitOfWork.Repository <PropertyType>().GetAll().Select(x => new SelectListItem { Text = x.Name, Value = Convert.ToString(x.Id) }); var contractType = iUnitOfWork.Repository <ContractType>().GetAll().Select(x => new SelectListItem { Text = x.Name, Value = Convert.ToString(x.Id) }); var amenity = iUnitOfWork.Repository <Amenity>().GetAll().Select(x => new SelectListItem { Text = x.Name, Value = Convert.ToString(x.Id), Selected = false }); var viewModel = new PropertyDetailViewModel() { CountryList = new SelectList(country, "Value", "Text"), StateList = new SelectList(state, "Value", "Text"), CityList = new SelectList(city, "Value", "Text"), AreaList = new SelectList(area, "Value", "Text"), PropertyTypeList = new SelectList(propertyType, "Value", "Text"), ContractList = new SelectList(contractType, "Value", "Text"), Amenity = new System.Collections.Generic.List <SelectListItem>(amenity) }; return(viewModel); }
public ActionResult PropertyDetail() { PropertyDetailViewModel viewModel = GetPropertyDetailViewModel(); return(View(viewModel)); }
public async Task <IActionResult> Create(PropertyDetailViewModel model, List <IFormFile> files) { if (ModelState.IsValid) { var user = await _userManager.FindByEmailAsync(User.Identity.Name); var property = new Property { UserId = user.Id, Title = model.Title, Description = model.Description, Area = model.Area, BathroomCount = model.BathroomCount, BuildingAge = model.BuildingAge, FloorCount = model.FloorCount, HasBalcony = model.HasBalcony, HasStuff = model.HasStuff, IsInSite = model.IsInSite, Price = model.Price, RoomCount = model.RoomCount, WhichFloor = model.WhichFloor, StateId = model.StateId, PropertyCategory = model.PropertyCategory, PropertyType = model.PropertyType }; _propertyService.Create(property); //Fotoğraf işlemleri if (files.Count > 0) { foreach (var file in files.ToList()) { if (file.Length > 0) { //Dosya ismini alıyoruz var fileName = Path.GetFileName(file.FileName); //Benzersiz isim tanımlıyoruz (Guid) var uniqueFileName = Convert.ToString(Guid.NewGuid()); //Dosya uzantısını alıyouz var fileExtension = Path.GetExtension(fileName); var newFileName = String.Concat(uniqueFileName, fileExtension); string wwwPath = _environment.WebRootPath; string folderPath = Path.Combine(wwwPath, $"img/{property.PropertyId}"); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } string filePath = Path.Combine(folderPath, newFileName); using (FileStream fs = System.IO.File.Create(filePath)) { file.CopyTo(fs); fs.Flush(); } _photoService.Create(new Photo { PhotoPath = newFileName, PropertyId = property.PropertyId }); } } } return(RedirectToRoute(new { controller = "Account", action = "UsersProperties", UserId = user.Id })); } return(View()); }