Exemplo n.º 1
0
 public void SaveSoldItems(List <SoldItems> soldproducts)
 {
     using (BmsDbContext context = new BmsDbContext())
     {
         context.SoldItem.AddRange(soldproducts);
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void SaveLedger(DATA.Domains.Ledger ledger)
 {
     using (BmsDbContext context = new BmsDbContext())
     {
         context.ledger.Add(ledger);
         context.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void SavePurchaseItems(List <DATA.Domains.PurchaseItem> products)
 {
     using (BmsDbContext context = new BmsDbContext())
     {
         context.PurchaseItem.AddRange(products);
         context.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public void Delete(int id)
 {
     using (BmsDbContext context = new BmsDbContext())
     {
         var deleteproduct = context.Product.Where(x => x.Id == id).FirstOrDefault();
         deleteproduct.IsDeleted = true;
         context.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public int Add(Trademark trademark)
 {
     using (BmsDbContext context = new BmsDbContext())
     {
         var TradeMarkToAdd = context.Trademark.Add(trademark);
         context.SaveChanges();
         return(TradeMarkToAdd.Id);
     }
 }
Exemplo n.º 6
0
 public void update(DATA.Domains.User user)
 {
     using (BmsDbContext context = new BmsDbContext())
     {
         var usertouptade = context.User.Where(x => x.Id == user.Id).FirstOrDefault();
         usertouptade.Password = user.Password;
         context.SaveChanges();
     }
 }
Exemplo n.º 7
0
 public void Delete(int id)
 {
     using (BmsDbContext context = new BmsDbContext())
     {
         var delete = context.AccountHolder.Where(x => x.Id == id).FirstOrDefault();
         delete.IsDeleted = true;
         context.SaveChanges();
     }
 }
Exemplo n.º 8
0
 public void Add(DATA.Domains.AccountHolder accountHolder)
 {
     using (BmsDbContext context = new BmsDbContext())
     {
         accountHolder.TradeMarkID = context.Trademark.FirstOrDefault().Id;
         context.AccountHolder.Add(accountHolder);
         context.SaveChanges();
     }
 }
Exemplo n.º 9
0
        public int Add(DATA.Domains.Product product)
        {
            using (BmsDbContext context = new BmsDbContext())
            {
                var productToAdd = context.Product.Add(product);
                context.SaveChanges();

                return(productToAdd.Id);
            }
        }
Exemplo n.º 10
0
 public void SaveCategory(DATA.Domains.Category category)
 {
     using (BmsDbContext context = new BmsDbContext())
     {
         var validate = context.Category.Where(name => name.Name == category.Name).FirstOrDefault();
         if (validate == null)
         {
             context.Category.Add(category);
             context.SaveChanges();
         }
     }
 }
Exemplo n.º 11
0
        public Sale GenerateSale()
        {
            using (BmsDbContext context = new BmsDbContext())
            {
                var sale = context.Sale.Add(new Sale {
                    CreatedOn = DateTime.UtcNow.ToLocalTime()
                });
                context.SaveChanges();

                return(sale);
            }
        }
Exemplo n.º 12
0
        public Purchase GeneratePurchase()
        {
            using (BmsDbContext context = new BmsDbContext())
            {
                var purchaase = context.Purchase.Add(new Purchase {
                    CreatedOn = DateTime.UtcNow.ToLocalTime()
                });
                context.SaveChanges();

                return(purchaase);
            }
        }
Exemplo n.º 13
0
        public int Delete(int id)
        {
            using (BmsDbContext context = new BmsDbContext())
            {
                var tradeMarkToDelete = context.Trademark.Where(x => x.Id == id).FirstOrDefault();

                tradeMarkToDelete.IsDeleted = true;

                context.SaveChanges();

                return(tradeMarkToDelete.Id);
            }
        }
Exemplo n.º 14
0
        public void Update(DATA.Domains.Trademark trademark)
        {
            using (BmsDbContext context = new BmsDbContext())
            {
                var tradeMarktoaupdate = context.Trademark.Where(x => x.Id == trademark.Id).FirstOrDefault();

                tradeMarktoaupdate.BussinessName = trademark.BussinessName;
                tradeMarktoaupdate.OwnerName     = trademark.OwnerName;
                tradeMarktoaupdate.Contact       = trademark.Contact;
                tradeMarktoaupdate.Address       = trademark.Address;
                tradeMarktoaupdate.Detail        = trademark.Detail;
                context.SaveChanges();
            }
        }
Exemplo n.º 15
0
        public void Update(DATA.Domains.AccountHolder accountHolder)
        {
            using (BmsDbContext context = new BmsDbContext())
            {
                var accountholderToUpdate = context.AccountHolder.Where(x => x.Id == accountHolder.Id).FirstOrDefault();

                accountholderToUpdate.FirstName           = accountHolder.FirstName;
                accountholderToUpdate.LastName            = accountHolder.LastName;
                accountholderToUpdate.Contact             = accountHolder.Contact;
                accountholderToUpdate.Address             = accountHolder.Address;
                accountholderToUpdate.Detail              = accountHolder.Detail;
                accountholderToUpdate.BankAccountNumber   = accountHolder.BankAccountNumber;
                accountholderToUpdate.AccountHolderTypeID = accountHolder.AccountHolderTypeID;

                context.SaveChanges();
            }
        }
Exemplo n.º 16
0
        public void Update(DATA.Domains.Product product)
        {
            using (BmsDbContext context = new BmsDbContext())
            {
                var productToupdate = context.Product.Where(x => x.Id == product.Id).FirstOrDefault();

                productToupdate.Name         = product.Name;
                productToupdate.Availability = product.Availability;
                productToupdate.BarCode      = product.BarCode;
                productToupdate.Brand        = product.Brand;
                productToupdate.Detail       = product.Detail;
                productToupdate.Color        = product.Color;
                productToupdate.Size         = product.Size;
                productToupdate.Cost         = product.Cost;
                productToupdate.Price        = product.Price;
                productToupdate.ImeNumber    = product.ImeNumber;
                productToupdate.IsActive     = product.IsActive;
                productToupdate.IsDeleted    = product.IsDeleted;
                context.SaveChanges();
            }
        }