示例#1
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            if (await _electionService.VerifyElectionOpenAsync())
            {
                ViewBag.Message = "No es posible eliminar ningun ciudadano porque actualmente existe una eleccion abierta.";
                return(RedirectToAction("Index"));
            }
            var citizen = await _citizenServices.GetCitizenByIdAsync(id);

            if (citizen != null)
            {
                await _citizenServices.DeleteCitizenAsync(citizen);
            }

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