public void Delete(int id)
        {
            var      db     = new ShopEnSonEntities();
            UsersOld result = db.UsersOld.Where(c => c.Id == id).FirstOrDefault();

            db.UsersOld.Remove(result);
            db.SaveChanges();
        }
        public void Delete(int id)
        {
            ShopEnSonEntities db  = new ShopEnSonEntities();
            Users             usr = db.Users.Where(c => c.Id == id).FirstOrDefault();

            db.Users.Remove(usr);
            db.SaveChanges();
        }
        public List <Users> List()
        {
            var          db     = new ShopEnSonEntities();
            List <Users> result = new List <Users>();

            result = db.Users.ToList();
            return(result);
        }
        public void Delete(int id)
        {
            var        db     = new ShopEnSonEntities();
            Categories result = db.Categories.Where(c => c.Id == id).FirstOrDefault();

            result = db.Categories.Remove(result);
            db.SaveChanges();
        }
        public List <Categories> List()
        {
            var db = new ShopEnSonEntities();
            List <Categories> result = new List <Categories>();

            result = db.Categories.ToList();
            return(result);
        }
        public UsersOld Insert(UsersOld entity)
        {
            var      db     = new ShopEnSonEntities();
            UsersOld result = new UsersOld();

            result = db.UsersOld.Add(entity);
            db.SaveChanges();
            return(result);
        }
        public List <UsersOld> List()
        {
            ShopEnSonEntities db     = new ShopEnSonEntities();
            List <UsersOld>   result = new List <UsersOld>();

            result = db.UsersOld.ToList();

            return(result);
        }
        public Users Insert(Users entity)
        {
            Users             result = new Users();
            ShopEnSonEntities db     = new ShopEnSonEntities();

            result = db.Users.Add(entity);
            db.SaveChanges();
            return(result);
        }
        public Categories Insert(Categories categories)
        {
            var        db     = new ShopEnSonEntities();
            Categories result = new Categories();

            result = db.Categories.Add(categories);
            db.SaveChanges();

            return(result);
        }
        public Categories Update(Categories entity)
        {
            var        db     = new ShopEnSonEntities();
            Categories result = db.Categories.Where(c => c.Id == entity.Id).FirstOrDefault();

            result.Name        = entity.Name;
            result.CatOrder    = entity.CatOrder;
            result.Description = entity.Description;
            db.SaveChanges();

            return(result);
        }
        public Users Update(Users entitiy)
        {
            ShopEnSonEntities db          = new ShopEnSonEntities();
            Users             defaultUser = db.Users.Where(c => c.Id == entitiy.Id).FirstOrDefault();

            defaultUser.Password = entitiy.Password;
            defaultUser.UserName = entitiy.UserName;
            defaultUser.FullName = entitiy.FullName;
            defaultUser.Credit   = entitiy.Credit;
            db.SaveChanges();

            return(defaultUser);
        }
        public UsersOld Update(UsersOld entity)
        {
            var      db     = new ShopEnSonEntities();
            UsersOld result = db.UsersOld.Where(c => c.Id == entity.Id).FirstOrDefault();

            result.Password = entity.Password;
            result.UserName = entity.UserName;
            result.FullName = entity.FullName;
            result.Bakiye   = entity.Bakiye;

            db.SaveChanges();

            return(result);
        }
Beispiel #13
0
 public ProductRepository()
 {
     db = new ShopEnSonEntities();
 }