コード例 #1
0
        public async Task <IActionResult> Edit(EditBindingModel advertisement)
        {
            if (!ModelState.IsValid)
            {
                return(Redirect($"/Advertisement/Edit?id={advertisement.Id}"));
            }

            var advertisementServiceModel = new AdvertisementEditServiceModel()
            {
                Id            = advertisement.Id,
                Name          = advertisement.Name,
                Price         = advertisement.Price,
                Description   = advertisement.Description,
                Condition     = advertisement.Condition,
                CategoryId    = advertisement.CategoryId,
                SubCategoryId = advertisement.SubCategoryId,
                TownId        = advertisement.TownId,
                Address       = advertisement.Address,
                Number        = advertisement.Number,
                UserId        = advertisement.UserId,
                Images        = advertisement.Images
            };

            await advertisementService.EditAsync(advertisementServiceModel);

            await NotifyOnAdEditAsync(advertisement.Id);

            return(Redirect($"/Advertisement/Details?id={advertisement.Id}"));
        }