Ejemplo n.º 1
0
        public int Add()
        {
            //var unit1 = new UnitOfWorkGeneric<Bill>(CoreService.Db);
            //var unit2 = new UnitOfWorkGeneric<BillItems>(CoreService.Db);

            //unit1.DbSet().Add(new Bill
            //{
            //    CustomerName = "Linh " + DateTime.Now.Ticks.ToString(),
            //    PayDate = DateTime.Now
            //});
            ////_billItemService.AddBillItem();
            //unit2.DbSet().Add(new BillItems
            //{
            //    Name = "Coding: " + DateTime.Now.Ticks.ToString(),
            //    Price = 19,
            //    Quantity = 1,
            //});

            //return unit1.SaveChanges();


            _unitOfWork.DbSet().Add(new Bill
            {
                CustomerName = "Linh " + DateTime.Now.Ticks.ToString(),
                PayDate      = DateTime.Now
            });
            _billItemService.AddBillItem();

            return(_unitOfWork.SaveChanges());
        }
Ejemplo n.º 2
0
        public int AddBillItem()
        {
            _unitOfWork.DbSet().Add(new BillItems
            {
                Name     = "Coding: " + DateTime.Now.Ticks.ToString(),
                Price    = 19,
                Quantity = 1,
            });

            //return _unitOfWork.DbSet().Count();
            return(1);
        }