コード例 #1
0
        //Thêm ở đây

        //==
        #region Các hàm static
        public static List <BangGiaLuyTien> DocTatCa()
        {
            var logic = new BangGiaLuyTienLogic();

            var config = new MapperConfiguration(cfg => cfg.CreateMap <BangGiaLuyTienBDO, BangGiaLuyTien>());
            var mapper = config.CreateMapper();
            List <BangGiaLuyTien> nguon = mapper.Map <List <BangGiaLuyTienBDO>, List <BangGiaLuyTien> >(logic.DocTatCa());

            return(nguon);
        }
コード例 #2
0
        public static string Sua(BangGiaLuyTien bangGia)
        {
            var logic  = new BangGiaLuyTienLogic();
            var config = new MapperConfiguration(cfg => cfg.CreateMap <BangGiaLuyTien, BangGiaLuyTienBDO>());
            var mapper = config.CreateMapper();
            var objBDO = mapper.Map <BangGiaLuyTienBDO>(bangGia);

            logic.Sua(objBDO);

            return("Sửa xong");
        }
コード例 #3
0
        public static string Them(BangGiaLuyTien bangGia)
        {
            var logic  = new BangGiaLuyTienLogic();
            var config = new MapperConfiguration(cfg => cfg.CreateMap <BangGiaLuyTien, BangGiaLuyTienBDO>());
            var mapper = config.CreateMapper();
            var objBDO = mapper.Map <BangGiaLuyTienBDO>(bangGia);

            //Thêm
            if (objBDO != null)
            {
                logic.Them(objBDO); //Thành công Mapper được
            }
            return("Đã thêm");
        }
コード例 #4
0
        public static BangGiaLuyTien DocTheoId(int idBangGia)
        {
            var logic = new BangGiaLuyTienLogic();

            var objBDO = logic.DocTheoId(idBangGia);

            var config = new MapperConfiguration(cfg => cfg.CreateMap <BangGiaLuyTienBDO, BangGiaLuyTien>()
                                                 );
            var mapper = config.CreateMapper();

            var objModel = mapper.Map <BangGiaLuyTien>(objBDO);

            //Trả về
            return(objModel);
        }