public ActionResult Delete(string UnitId, string ProcessId, string ActivityId, int?id, int?CustomerId) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } List <NavViewModel> Nav = new List <NavViewModel>(); UnitProcessActObjectViewModel UPA = new UnitProcessActObjectViewModel(); if (!DmlObj.GetUPAwithNav(UnitId, ProcessId, ActivityId, User.GetAmUser(), out Nav, out UPA)) { return(View("Error")); } ViewBag.Nav = Nav; ViewBag.UPA = UPA; AMLoan LoanObj = DmlObj.GetLoanById(id); if (LoanObj == null) { return(HttpNotFound()); } return(View(LoanObj)); }
public ActionResult DeleteConfirmed(string UnitId, string ProcessId, string ActivityId, int id) { AMLoan LoanObj = DmlObj.GetLoanById(id); if (DmlObj.DeleteLoan(LoanObj)) { return(RedirectToAction("Index", "Customer", new { UnitId = UnitId, ProcessId = ProcessId, ActivityId = ActivityId })); } else { return(View("Error")); } }
public ActionResult Edit([Bind(Include = "Id,LoanType,LoanNumber")] AMLoan LoanObj, string UnitId, string ProcessId, string ActivityId, int CustomerId) { List <NavViewModel> Nav = new List <NavViewModel>(); UnitProcessActObjectViewModel UPA = new UnitProcessActObjectViewModel(); if (!DmlObj.GetUPAwithNav(UnitId, ProcessId, ActivityId, User.GetAmUser(), out Nav, out UPA)) { return(View("Error")); } ViewBag.Nav = Nav; ViewBag.UPA = UPA; var k = DmlObj.GetCustomerById(CustomerId); if (k == null) { ModelState.AddModelError("AccountNumber", "مشتری شناسایی نشد"); } if (LoanObj.LoanType == 0) { ModelState.AddModelError("AccountType", "نوع حساب انتخاب نشده است"); } if (LoanObj.LoanNumber.Length < 6 && LoanObj.LoanNumber.Length > 13) { ModelState.AddModelError("AccountNumber", "شماره حساب نادرست است"); } if (ModelState.IsValid) { AMLoan EditObj = DmlObj.GetLoanById(LoanObj.Id); EditObj.LoanType = LoanObj.LoanType; EditObj.LoanNumber = LoanObj.LoanNumber; if (DmlObj.EditLoan(EditObj)) { ViewBag.Customer = k; return(View("Success")); } } ViewBag.Customer = k == null ? new AMCustomer { Id = 0, FirstName = "مشتری شناسایی نشد" } : k; return(View(LoanObj)); }
public ActionResult Edit(string UnitId, string ProcessId, string ActivityId, int?CustomerId, int?LoanId) { if (LoanId == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } List <NavViewModel> Nav = new List <NavViewModel>(); UnitProcessActObjectViewModel UPA = new UnitProcessActObjectViewModel(); if (!DmlObj.GetUPAwithNav(UnitId, ProcessId, ActivityId, User.GetAmUser(), out Nav, out UPA)) { return(View("Error")); } ViewBag.Nav = Nav; ViewBag.UPA = UPA; var k = DmlObj.GetCustomerById(CustomerId); if (k != null) { ViewBag.Customer = k; } else { ViewBag.Customer = new AMCustomer { Id = 0, FirstName = "مشتری شناسایی نشد" }; } AMLoan LoanObj = DmlObj.GetLoanById(LoanId); if (LoanObj == null) { return(HttpNotFound()); } return(View(LoanObj)); }