public void AddNewUser()
        {
            var user = new User()
            {
                Email     = "*****@*****.**",
                FirstName = "Erandika",
                IsActive  = true,
                LastName  = "Sandaruwan",
                MobileNo  = "0702605650",
                Password  = CustomPasswordHasher.GenerateHash("system"),
                Username  = "******",
            };

            user.UserRoles = new HashSet <UserRole>();

            var userRole = new UserRole()
            {
                IsActive    = true,
                RoleId      = 1,
                StartedDate = DateTime.UtcNow
            };

            user.UserRoles.Add(userRole);
            _db.SaveChanges();
        }
Exemple #2
0
 public bool CreateCustomer(DataCustomer customer)
 {
     try
     {
         _context.Customer.Add(customer);
         _context.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Exemple #3
0
 public bool CreateAddress(DataAddress Address)
 {
     try
     {
         _context.Address.Add(Address);
         _context.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }