コード例 #1
0
        [ValidateAntiForgeryToken] //Evitar/Previnir ataques CSRF
        public async Task <IActionResult> Delete(int id, int page)
        {                          //DELETE
            try
            {
                await _cidadeService.RemoveAsync(id);

                //return RedirectToAction(nameof(Index));
                return(RedirectToAction("Index", new { page = page }));
            }
            catch (IntegrityException e) // exceção a nível de Serviço
            {
                return(RedirectToAction(nameof(Error), new { message = e.Message }));
            }
        }