public IActionResult ApprovePayment(FinePayment _fine) { var _fineP = finepay.GetById(_fine.FinePaymentID); if (_fineP.FinePaymentStatusID != 2) { var _fi = fineOps.GetById(_fineP.FineID); var _case = caseOps.GetById(_fi.CaseID); var _offender = offenderOps.GetById(_fi.OffenderID); _fineP.FinePaymentStatusID = 2; _fi.FineStatusID = 2; _case.CaseStatusID = 2; _offender.StatusID = 2; finepay.Update(_fineP); fineOps.Update(_fi); caseOps.Update(_case); offenderOps.Update(_offender); ViewBag.Message = "Fine Payment Approved successfuly"; ViewBag.MessageType = "Warining"; return(RedirectToAction("ViewFinePayment")); } else { ViewBag.Message = "Fine Payment Already Approved"; ViewBag.MessageType = "Warining"; return(RedirectToAction("ViewFinePayment")); } }
public IActionResult Edit(Case model) { ViewBag.OffenceID = new SelectList(offence.GetAll(), "OffenseID", "Name"); if (model.CourtDate != null && model.DateOfArrest != null) { if (model.CourtDate < model.DateOfArrest) { ViewBag.Message = "Court date cannot be earlier than the date of arrest"; ViewBag.MessageType = "Warining"; return(View(model)); } else { var ofresult = officer.SearchByForceNumber(model.Officer.ForceNumber); if (ofresult != null) { model.OfficerID = ofresult.OfficerID; var fromdb = caseOps.GetById(model.CaseID); fromdb.CaseDescription = model.CaseDescription; fromdb.CrimeLocation = model.CrimeLocation; fromdb.DateOfArrest = model.DateOfArrest; fromdb.DateOfCrime = model.DateOfCrime; fromdb.OffenceID = model.OffenceID; fromdb.OfficerID = model.OfficerID; fromdb.CourtDate = model.CourtDate; caseOps.Update(fromdb); return(RedirectToAction("Index")); } else { ViewBag.Message = "Force Number invalid: No officer was found under this force number"; ViewBag.MessageType = "Warining"; return(View(model)); } } } else { var ofresult = officer.SearchByForceNumber(model.Officer.ForceNumber); if (ofresult != null) { model.OfficerID = ofresult.OfficerID; var fromdb = caseOps.GetById(model.CaseID); fromdb.CaseDescription = model.CaseDescription; fromdb.CrimeLocation = model.CrimeLocation; fromdb.DateOfArrest = model.DateOfArrest; fromdb.DateOfCrime = model.DateOfCrime; fromdb.OffenceID = model.OffenceID; fromdb.OfficerID = model.OfficerID; fromdb.CourtDate = model.CourtDate; caseOps.Update(fromdb); return(RedirectToAction("Index")); } else { ViewBag.Message = "Force Number invalid: No officer was found under this force number"; ViewBag.MessageType = "Warining"; return(View(model)); } } }