Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateAdvertisement(EditAdvertisementForm advertisementForm)
        {
            var advertisement = await ParseAdvertisementAsync(advertisementForm);

            await UploadImages(advertisementForm.Images);

            await _advertisementService.UpdateAdvertisementAsync(advertisementForm.Id, advertisement);

            return(Redirect($"{advertisement.Id}"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> EditAdvertisement(int id)
        {
            var advertisement = await _advertisementService.GetAdvertisementAsync(id);

            EditAdvertisementForm model = new EditAdvertisementForm
            {
                Id                 = advertisement.Id,
                Title              = advertisement.Title,
                Price              = advertisement.Price,
                DaysToLive         = advertisement.DaysToLive,
                Description        = advertisement.Description,
                IsBuying           = advertisement.SellerId == null ? false : true,
                IsUsed             = advertisement.Condition == DAL.Entities.Condition.Used ? true : false,
                CategoryId         = advertisement.CategoryId,
                CityId             = advertisement.CityId,
                PropertyInputs     = advertisement.AdvertisementProperties,
                OriginalImagePaths = advertisement.AdvertisementImagePaths
            };

            return(View(model));
        }