public async Task <IActionResult> Delete(int id) { BeneficiarioDeleteInputModel inputModel = new BeneficiarioDeleteInputModel(); inputModel.IDBeneficiario = id; if (ModelState.IsValid) { await service.DeleteBeneficiarioAsync(inputModel); TempData["Message"] = "Cancellazione effettuata correttamente".ToUpper(); return(RedirectToAction("Index")); } else { ViewData["Title"] = "Elimina beneficiario".ToUpper(); return(View(inputModel)); } }
public async Task DeleteBeneficiarioAsync(BeneficiarioDeleteInputModel inputModel) { await beneficiarioService.DeleteBeneficiarioAsync(inputModel); memoryCache.Remove($"Beneficiario{inputModel.IDBeneficiario}"); }