コード例 #1
0
        public async Task <IActionResult> AddOrEdit(int?id)
        {
            var model = new EstateAddOrEditViewModel();

            model.Cities = await _cityAppService.GetAllCities();

            model.EstateTypes = await _etAppService.GetAllEstateTypes();

            model.SaleTypes = await _saleTypeAppService.GetAllsaleTypes();

            if (id != null)
            {
                var e = await _estateAppService.GetEstateById(id.Value);

                model.Districts = await _districtAppService.GetDistrictByCityId(e.CityId);

                model.Mahalles = await _mahalleAppService.GetMahallesByDistrictId(e.DistrictId);

                model.estate       = e;
                model.estate.Price = Convert.ToDecimal(e.Price.ToString().Substring(0, e.Price.ToString().Length - 3));
                //model.estate.Price = Convert.ToDecimal(e.Price.ToString().Replace(',','.'));
            }
            //model.Districts = await _districtAppService.GetAllDistricts();
            //model.Mahalles = await _mahalleAppService.GetAllMahalles();
            return(View(model));
        }