Ejemplo n.º 1
0
        public IActionResult EditAd(EditAdModel model)
        {
            var myUser = GetMyUser();

            var adInfo = _adMapper.GetAdEditInfo(myUser, model);

            if (!adInfo.Success)
            {
                FillBaseModel(model);
                FillPlaceAdCollections(model);
                FillPlaceAdPicsIfAny(model);
                return(View(model));
            }

            var resultEditAd = _adsService.EditAd(adInfo.Value);

            if (!resultEditAd.Success)
            {
                FillBaseModel(model);
                FillPlaceAdCollections(model);
                FillPlaceAdPicsIfAny(model);
                return(View(model));
            }

            return(RedirectToAction(nameof(MyAds)));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(EditAdBindingModel bindingModel)
        {
            await adService.EditAd(bindingModel.EditAdInputModel);

            TempData["SuccessfullyEditedAdsMessage"] = SuccessfullyEditedAdsMessage;

            return(RedirectToAction("ActiveAds"));
        }