Exemple #1
0
 public Task <UserDTO> Add(UserDTO user)
 {
     return(Task.Run(() =>
     {
         User newUser = new GenericMapper <UserDTO, User>().Map(user);
         _db.Users.Add(newUser);
         _db.SaveChanges();
         return user;
     }));
 }
Exemple #2
0
 public static void PopulateUser()
 {
     if (_db.Users.ToList().Count <= 0)
     {
         User newUser = new User
         {
             FirstName            = Faker.Name.FirstName(),
             LastName             = Faker.Name.LastName(),
             CreatedBy            = Faker.Name.Name(),
             Email                = "*****@*****.**",
             Password             = BCrypt.Net.BCrypt.HashPassword("123456"),
             IdentificationNumber = Faker.Number.Number(6),
             ModifiedBy           = Faker.Name.Name(),
             Role = "admin"
         };
         _db.Users.Add(newUser);
         _db.SaveChanges();
     }
 }