Пример #1
0
        public void Add(Products entity)
        {
            myShopEntities db = new myShopEntities();

            db.Products.Add(entity);
            db.SaveChanges();
        }
Пример #2
0
        public virtual List <T> List()
        {
            db = new myShopEntities();
            List <T> result = db.Set <T>().ToList();

            return(result);
        }
Пример #3
0
        public void Delete(int id)
        {
            myShopEntities db     = new myShopEntities();
            var            entity = db.Set <Products>().Where(c => c.Id == id).FirstOrDefault();

            db.Set <Products>().Remove(entity);
            db.SaveChanges();
        }
Пример #4
0
        public void Delete(int id)
        {
            myShopEntities db = new myShopEntities();

            Users usr = db.Users.Where(c => c.Id == id).FirstOrDefault();

            db.Users.Remove(usr);
            db.SaveChanges();
        }
Пример #5
0
        public Users Insert(Users entity)
        {
            Users          result = new Users();
            myShopEntities db     = new myShopEntities();

            result = db.Users.Add(entity);
            db.SaveChanges();
            return(result);
        }
Пример #6
0
        public Users Update(Users entity)
        {
            myShopEntities db          = new myShopEntities();
            Users          defaultUser = db.Users.Where(c => c.Id == entity.Id).FirstOrDefault();

            defaultUser.Password = entity.Password;
            defaultUser.UserName = entity.UserName;
            defaultUser.FullName = entity.FullName;
            defaultUser.Credit   = entity.Credit;
            db.SaveChanges();
            return(defaultUser);
        }
Пример #7
0
        public void Update(Products entity)
        {
            myShopEntities db             = new myShopEntities();
            var            updateEdilecek = db.Set <Products>().Where(c => c.Id == entity.Id).FirstOrDefault();

            updateEdilecek.Name        = entity.Name;
            updateEdilecek.Price       = entity.Price;
            updateEdilecek.productCode = entity.productCode;
            updateEdilecek.stocks      = entity.stocks;
            updateEdilecek.categoryId  = entity.categoryId;

            db.SaveChanges();
        }
Пример #8
0
 public UserOldRepository()
 {
     db = new myShopEntities();
 }
Пример #9
0
 public CategoryRepository()
 {
     db = new myShopEntities();
 }
Пример #10
0
 public BaseRepository()
 {
     db = new myShopEntities();
 }
Пример #11
0
 public ProductRepository()
 {
     db = new myShopEntities();
 }