Esempio n. 1
0
        public NganHang MethodReturnObject()
        {
            NganHang nh = new NganHang();

            nh.MaNH   = "NH0001";
            nh.TenNH  = "Asia Commercial Joint Stock Bank";
            nh.LoaiNH = "ACB";
            return(nh);
        }
Esempio n. 2
0
        public ReturnObjValueBackEnd SearchBankingByCondition(CreditManagement.Models.NganHang sc)
        {
            List <CreditManagement.Models.NganHang> lst = new List <CreditManagement.Models.NganHang>();

            retObjValueBackEnd = new ReturnObjValueBackEnd();

            try
            {
                var ctx   = new BankingContext();
                var query = from ct in ctx.NganHang
                            select ct;

                if (sc != null)
                {
                    if (sc.MaNH != null)
                    {
                        query = query.Where(p => p.MaNH.Equals(sc.MaNH));
                    }

                    if (sc.TenNH != null)
                    {
                        query = query.Where(p => p.TenNH.Contains(sc.TenNH));
                    }

                    if (sc.LoaiNH != null)
                    {
                        query = query.Where(p => p.LoaiNH.Equals(sc.LoaiNH));
                    }
                }

                retObjValueBackEnd.Success = true;
                retObjValueBackEnd.Data    = lst.ToArray();
                return(retObjValueBackEnd);
            }
            catch (Exception ex)
            {
                retObjValueBackEnd.Success = false;
                retObjValueBackEnd.Message = ex.ToString();
                return(retObjValueBackEnd);

                throw ex;
            }
        }
Esempio n. 3
0
        public ReturnObjValueBackEnd InsertBanking(CreditManagement.Models.NganHang objInsert)
        {
            retObjValueBackEnd = new ReturnObjValueBackEnd();
            try
            {
                var ctx = new BankingContext();
                ctx.NganHang.Add(objInsert);
                ctx.SaveChanges();
                retObjValueBackEnd.Success = true;
                return(retObjValueBackEnd);
            }
            catch (Exception ex)
            {
                retObjValueBackEnd.Success = false;
                retObjValueBackEnd.Message = ex.ToString();
                return(retObjValueBackEnd);

                throw ex;
            }
        }
Esempio n. 4
0
        public ReturnObjValueBackEnd UpdateBanking(CreditManagement.Models.NganHang objUpdate)
        {
            retObjValueBackEnd = new ReturnObjValueBackEnd();

            try
            {
                var ctx = new BankingContext();
                ctx.Entry(objUpdate).State = System.Data.Entity.EntityState.Modified;
                ctx.SaveChanges();
                retObjValueBackEnd.Success = true;
                return(retObjValueBackEnd);
            }
            catch (Exception ex)
            {
                retObjValueBackEnd.Success = false;
                retObjValueBackEnd.Message = ex.ToString();
                return(retObjValueBackEnd);

                throw ex;
            }
        }