public ActionResult ConfirmDeleteBankAccnt(int PrimaryID) { Tbl_FMBank_BankAccounts Bacctype = (from a in BOSSDB.Tbl_FMBank_BankAccounts where a.BankAccntID == PrimaryID select a).FirstOrDefault(); BOSSDB.Tbl_FMBank_BankAccounts.Remove(Bacctype); BOSSDB.SaveChanges(); var result = ""; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteBankAccnt(int PrimaryID) { Tbl_FMBank_BankAccounts bankAccnt = (from a in BOSSDB.Tbl_FMBank_BankAccounts where a.BankAccntID == PrimaryID select a).FirstOrDefault(); var confirmDelete = ""; if (bankAccnt != null) { confirmDelete = "false"; } var result = new { confirmDelete = confirmDelete }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteBank(int PrimaryID) { Tbl_FMBank_Banks banks = (from a in BOSSDB.Tbl_FMBank_Banks where a.BankID == PrimaryID select a).FirstOrDefault(); Tbl_FMBank_BankAccounts bankaccnt = (from a in BOSSDB.Tbl_FMBank_BankAccounts where a.BankID == PrimaryID select a).FirstOrDefault(); //Tbl_FMBrgy_BrgyBankAccount brgy = (from a in BOSSDB.Tbl_FMBrgy_BrgyBankAccount where a.BankID == PrimaryID select a).FirstOrDefault(); var confirmDelete = ""; if (banks != null) { if (bankaccnt != null) { confirmDelete = "true"; } else { confirmDelete = "false"; } } var result = new { confirmDelete = confirmDelete }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult SaveBankAccnt(BankAccountsModel model) { var isExist = ""; if (ModelState.IsValid) { var accntname = model.BankAccntList.AccntName; var bankid = model.BankAccntList.BankID; var accntnumber = model.BankAccntList.AccntNo; Tbl_FMBank_BankAccounts checkbankaccnt = (from a in BOSSDB.Tbl_FMBank_BankAccounts where (a.AccntNo == accntnumber) select a).FirstOrDefault(); if (model.ActionID == 1) { if (checkbankaccnt == null) { Tbl_FMBank_BankAccounts BankAccnt = new Tbl_FMBank_BankAccounts(); BankAccnt.AccntName = accntname; BankAccnt.AccntNo = accntnumber; BankAccnt.BankID = bankid; BankAccnt.FundID = model.BankAccntList.FundID; BankAccnt.GAID = model.BankAccntList.GAID; BankAccnt.AccntTypeID = model.BankAccntList.AccntTypeID; BOSSDB.Tbl_FMBank_BankAccounts.Add(BankAccnt); BOSSDB.SaveChanges(); isExist = "false"; } else if (checkbankaccnt != null) { isExist = "true"; } } else if (model.ActionID == 2) { Tbl_FMBank_BankAccounts bankTypii = (from a in BOSSDB.Tbl_FMBank_BankAccounts where a.BankAccntID == model.BankAccntList.BankAccntID select a).FirstOrDefault(); if (checkbankaccnt != null) { if (bankTypii.AccntNo == accntnumber && bankTypii.BankAccntID == model.BankAccntList.BankAccntID) { isExist = "justUpdate"; } else { isExist = "true"; } } else if (checkbankaccnt == null) { isExist = "justUpdate"; } if (isExist == "justUpdate") { bankTypii.AccntName = accntname; bankTypii.AccntNo = accntnumber; bankTypii.BankID = bankid; bankTypii.FundID = model.BankAccntList.FundID; bankTypii.GAID = model.BankAccntList.GAID; bankTypii.AccntTypeID = model.BankAccntList.AccntTypeID; bankTypii.BankAccntID = model.BankAccntList.BankAccntID; BOSSDB.Entry(bankTypii); BOSSDB.SaveChanges(); } } } return(new JsonResult() { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new { isExist = isExist } }); }