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(); }
public bool CreateCustomer(DataCustomer customer) { try { _context.Customer.Add(customer); _context.SaveChanges(); return(true); } catch (Exception e) { return(false); } }
public bool CreateAddress(DataAddress Address) { try { _context.Address.Add(Address); _context.SaveChanges(); return(true); } catch (Exception e) { return(false); } }