public async Task <EstateObjectViewModel> Model(EstateObject eo)
        {
            List <Picture> pictures = await EstateObjectsRepository.Pictures(eo.Id);

            EstateObjectViewModel model = new EstateObjectViewModel
            {
                Id              = eo.Id,
                Price           = eo.Price,
                Address         = eo.Address,
                Description     = eo.Description,
                Area            = eo.Area,
                Rooms           = eo.Rooms,
                LandDescription = eo.LandDescription,
                LandArea        = eo.LandArea,
                District        = eo.District.Name,
                RealtyType      = eo.RealtyType.Name,
                TradeType       = eo.TradeType.Name,
                Owner           = eo.Owner.Phone,
                Pictures        = pictures,
                RealtyTypeId    = eo.RealtyTypeId,
                TradeTypeId     = eo.TradeTypeId,
                DistrictId      = eo.DistrictId,
                OwnerId         = eo.OwnerId,
                RealtyTypes     = PrepareRealtyTypes(),
                TradeTypes      = PrepareTradeTypes(),
                Districts       = PrepareDistricts(),
                Owners          = PrepareOwners(),
            };

            return(model);
        }
        public async Task <EstateObject> EstateObject(EstateObjectViewModel model)
        {
            List <Picture> pictures = await EstateObjectsRepository.Pictures(model.Id);

            EstateObject eo = new EstateObject
            {
                Id              = model.Id,
                Price           = model.Price,
                Address         = model.Address,
                Description     = model.Description,
                Area            = model.Area,
                Rooms           = model.Rooms,
                LandDescription = model.LandDescription,
                LandArea        = model.LandArea,
                RealtyTypeId    = model.RealtyTypeId,
                TradeTypeId     = model.TradeTypeId,
                DistrictId      = model.DistrictId,
                OwnerId         = model.OwnerId,
                StatusId        = 1,
            };

            return(eo);
        }
 public EstateObjectService()
 {
     _estateObjectsRepository = new EstateObjectsRepository();
 }