public Categorie creatcat(Categorie categorie)
        {
            db.categories.Add(categorie);
            db.SaveChanges();

            return(categorie);
        }
Exemplo n.º 2
0
        public void updateuser(int id)
        {
            var user = GetById(id);

            user.etat = "validé";
            db.Users.Update(user);
            db.SaveChanges();
        }
Exemplo n.º 3
0
        public Users Create(Users user, string password)
        {
            // validation
            if (string.IsNullOrWhiteSpace(password))
            {
                throw new AppException("Password is required");
            }

            if (db.Users.Any(x => x.Email == user.Email))
            {
                throw new AppException("Email \"" + user.Email + "\" is already taken");
            }

            byte[] passwordHash, passwordSalt;
            CreatePasswordHash(password, out passwordHash, out passwordSalt);
            user.PasswordHash = passwordHash;
            user.PasswordSalt = passwordSalt;
            user.Roles        = Roles.User;
            db.Users.Add(user);
            db.SaveChanges();

            return(user);
        }
Exemplo n.º 4
0
 public Sous_cat Creation(Sous_cat soucat)
 {
     db.Sous_Cats.Add(soucat);
     db.SaveChanges();
     return(soucat);
 }