Пример #1
0
        public async Task <IActionResult> Delete(long id)
        {
            var seller = await HttpContext.GetMemberAsync();

            var banner = await _bannerService.GetAsync(new BannerFilter()
            {
                SellerId = seller.Id, BannerId = id
            });

            if (banner != null)
            {
                await _bannerService.DeleteAsync(banner);

                TempData.AddAlert(AlertMode.Notify, AlertType.Success, $"\"{banner.Title}\" banner was deleted.");
            }
            else
            {
                TempData.AddAlert(AlertMode.Notify, AlertType.Error, $"Banner does not exist.");
            }

            return(RedirectToAction(nameof(Index)));
        }