Exemplo n.º 1
0
        public string SaveUpdateBankDetails(BankAccountModel model)
        {
            ShomaRMEntities db  = new ShomaRMEntities();
            string          msg = "";

            if (model.BAID == 0)
            {
                var saveBankDetails = new tbl_BankAccount()
                {
                    Bank_Name      = model.Bank_Name,
                    Account_Number = model.Account_Number,
                    Account_Type   = model.Account_Type,
                };
                db.tbl_BankAccount.Add(saveBankDetails);
                db.SaveChanges();
                msg = "Bank Details Saved Successfully";
            }
            else
            {
                var getBDdata = db.tbl_BankAccount.Where(p => p.BAID == model.BAID).FirstOrDefault();
                if (getBDdata != null)
                {
                    getBDdata.Bank_Name      = model.Bank_Name;
                    getBDdata.Account_Number = model.Account_Number;
                    getBDdata.Account_Type   = model.Account_Type;
                }
                db.SaveChanges();
                msg = "Bank Details Updated Successfully";
            }
            db.Dispose();
            return(msg);
        }
Exemplo n.º 2
0
        public BankAccountModel GetBankDetails(int id)
        {
            ShomaRMEntities  db    = new ShomaRMEntities();
            BankAccountModel model = new BankAccountModel();

            var getBankdata = db.tbl_BankAccount.Where(p => p.BAID == id).FirstOrDefault();

            if (getBankdata != null)
            {
                model.Bank_Name      = getBankdata.Bank_Name;
                model.Account_Number = getBankdata.Account_Number;
                model.Account_Type   = getBankdata.Account_Type;
            }
            model.BAID = id;
            return(model);
        }