public ActionResult Delete(int id) { ChildStatusHistory csh = beneficiaryStatusService.fetchByID(id); { Beneficiary beneficiary = beneficiaryService.FetchById(csh.BeneficiaryID.Value); if (csh.ChildStatus.Description == "Initial" || csh.ChildStatus.Description == "Inicial" || csh.ChildStatus.Description == "Adult" || csh.ChildStatus.Description == "Adulto") { TempData["Error"] = "O estado Inicial ou Adulto não podem ser removidos."; return(RedirectToAction("Edit", "Beneficiaries", new { id = currentScreenID })); } beneficiaryStatusService.Delete(csh); return(RedirectToAction("Edit", "Beneficiaries", new { id = currentScreenID })); } }
public ActionResult Delete(int id) { HIVStatus hivstatus = hivStatusService.findByID(id); { Beneficiary beneficiary = beneficiaryService.FetchById(hivstatus.BeneficiaryID); if (hivstatus.HIVStatusID == beneficiary.HIVStatusID) { TempData["Error"] = LanguageResource.HIVStatus_Validation_First_HIVStatus_Cannot_Be_Removed; return(RedirectToAction("Edit", "Beneficiaries", new { id = currentScreenID })); } hivStatusService.Delete(hivstatus); hivStatusService.Commit(); return(RedirectToAction("Edit", "Beneficiaries", new { id = currentScreenID })); } }
// GET: Beneficiaries/Details/5 public ActionResult Details(int?id, string fromHouseholdView) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Beneficiary Beneficiary = beneficiaryService.FetchById(id.Value); if (Beneficiary == null) { return(HttpNotFound()); } // beneficiaryService.EvaluateBeneficiaryServicesState(Beneficiary); ViewBag.HIVStatuses = hivStatusService.findAllBeneficiaryStatuses(Beneficiary); ViewBag.CurrentChildStatus = beneficiaryStatusService.FetchChildStatusHistoryByBeneficiary(Beneficiary).LastOrDefault(); ViewBag.ChildStatusHistoryList = beneficiaryStatusService.FetchChildStatusHistoryByBeneficiary(Beneficiary).ToList(); ViewBag.fromHouseholdView = fromHouseholdView; return(View(Beneficiary)); }