public ActionResult AddAccount(account_details objAccount, int CustomerId) { if (ModelState.IsValid) { ObjectParameter objParam = new ObjectParameter("Id_Output", typeof(int)); int insert = db.usp_insert_account(objAccount.AccountId, CustomerId, objAccount.AccountType, objAccount.Balance, objParam); this.db.SaveChanges(); int insertVal = Convert.ToInt32(objParam.Value); if (insertVal == -1) { TempData["notice"] = "Account Already Exists"; ModelState.Clear(); return(View()); } else if (insertVal == -2) { TempData["notice"] = "Customer does not exist"; ModelState.Clear(); return(View()); } else { TempData["notice"] = "Account added successfully with Account ID: " + insertVal; ModelState.Clear(); return(View()); } } return(View(objAccount)); }
public ActionResult SearchAcc(account_details acc) { if (acc.CustomerId != 0) { List <usp_viewAccount_by_customerid_or_Accountid_Result> ob = new List <usp_viewAccount_by_customerid_or_Accountid_Result>(); //ob = db.usp_view_by_customerid(cus.CustomerId).ToList(); long c = 0; //customer_details c_details = new customer_details(); ob = db.usp_viewAccount_by_customerid_or_Accountid(acc.CustomerId, c).ToList(); return(View("disp", ob)); } else if (acc.AccountId != 0) { List <usp_viewAccount_by_customerid_or_Accountid_Result> ob = new List <usp_viewAccount_by_customerid_or_Accountid_Result>(); ob = db.usp_viewAccount_by_customerid_or_Accountid(0, acc.AccountId).ToList(); return(View("disp", ob)); } return(View()); }
public ActionResult Delete(account_details acc_obj) { TempData["id"] = acc_obj.AccountId; return(RedirectToAction("ConfirmDelete")); }