public IActionResult Edit(int ID) { TempData["CaseID"] = ID; var result = caseOps.GetById(ID); if (result.CaseStatusID == 2) { return(RedirectToAction("Details", new { id = ID })); } else { ViewBag.OffenceID = new SelectList(offence.GetAll(), "OffenseID", "Name"); //ViewBag.caseoff = caseof.GetById(ID); return(View(result)); } }
public IActionResult Edit(int FindeId, int CaseId) { var _case = caseOps.GetById(CaseId); var _fine = fineOps.GetById(FindeId); var result = finepay.GetAll().Where(f => f.FineID == _fine.FineID).SingleOrDefault <FinePayment>(); if (result != null && result.FinePaymentStatusID == 2) { ViewBag.Message = "Fine Has been already payed"; ViewBag.MessageType = "Warining"; return(View()); } else if (result != null && result.FinePaymentStatusID == 1) { return(View(result)); } else { var userid = context.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault(); var _amortization = amortization.GetAll().Where(am => am.CaseID == _case.CaseID && am.FineID == _fine.FineID).SingleOrDefault <Amortization>(); var fnp = new FinePayment { RelativeID = context.Relatives.Where(r => r.IdentityUserID == userid.Id).FirstOrDefault <Relative>().RelativeID, FineID = _fine.FineID, AmortizationID = _amortization.AmortizationID, AmortizationAmount = _amortization.AmortizationAmount, AmountPayable = amortizationCalculate.AmountPayable(_case, _fine), Fine = _fine, Amortization = _amortization, Relative = context.Relatives.Where(r => r.IdentityUserID == userid.Id).FirstOrDefault <Relative>() }; return(View(fnp)); } }