public async Task <IActionResult> EditAd(int id) { AdViewModel model = new AdViewModel(); var getAdByIdResult = await _adService.GetAdById(id, dataForEdit : true); if (!getAdByIdResult.Succedeed) { return(View("Details", model)); } var dataForSelectList = _adService.GetDataForCreatingAdOrDataForFilter(); model = _prepearingModel.PrepearingAdViewModel( dataForSelectList.citiesDTO, dataForSelectList.cityAreasDTO, dataForSelectList.productTypesDTO, dataForSelectList.productModelsDTO, dataForSelectList.productMemoriesDTO, dataForSelectList.productColorsDTO, dataForSelectList.productStateDTO, getAdByIdResult.Property); ViewBag.AdId = id; return(View("Details", model)); }
public async Task <IActionResult> CreateAd() { var dataForSelectList = _adService.GetDataForCreatingAdOrDataForFilter(); AdViewModel model = new AdViewModel(); model = _prepearingModel.PrepearingAdViewModel( dataForSelectList.citiesDTO, dataForSelectList.cityAreasDTO, dataForSelectList.productTypesDTO, dataForSelectList.productModelsDTO, dataForSelectList.productMemoriesDTO, dataForSelectList.productColorsDTO, dataForSelectList.productStateDTO, new AdDTO()); return(View(model)); }