Exemplo n.º 1
0
        public async Task <IActionResult> Delete(StaticContentViewModel viewModel)
        {
            var staticContentViewModel = await _staticContentService.GetByIdAsync(viewModel.Id);

            if (staticContentViewModel == null)
            {
                ModelState.AddModelError("", RequestNotFound);
            }
            else
            {
                var result = await _staticContentService.DeleteAsync(staticContentViewModel.Id);

                if (result)
                {
                    return(Json(new { success = true }));
                }

                ModelState.AddModelError("", RequestNotFound);
            }

            return(PartialView("_Delete", model: viewModel));
        }