예제 #1
0
        public async Task <IActionResult> AddProperty(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var owner = await _dataContext.Owners.FindAsync(id.Value);

            if (owner == null)
            {
                return(NotFound());
            }

            var view = new PropertyViewModel
            {
                OwnerId       = owner.Id,
                PropertyTypes = _combosHelpers.GetComboPropertyTypes()
            };

            return(View(view));
        }
예제 #2
0
 public PropertyViewModel ToPropertyViewModel(Property property)
 {
     return(new PropertyViewModel
     {
         Address = property.Address,
         Contracts = property.Contracts,
         HasParkingLot = property.HasParkingLot,
         Id = property.Id,
         IsAvailable = property.IsAvailable,
         Neighborhood = property.Neighborhood,
         Owner = property.Owner,
         Price = property.Price,
         PropertyImages = property.PropertyImages,
         PropertyType = property.PropertyType,
         Remarks = property.Remarks,
         Rooms = property.Rooms,
         SquareMeters = property.SquareMeters,
         Stratum = property.Stratum,
         OwnerId = property.Owner.Id,
         PropertyTypeId = property.PropertyType.Id,
         PropertyTypes = _combosHelpers.GetComboPropertyTypes(),
     });
 }