Esempio n. 1
0
 public IEnumerable <User> AddUsers(NewUsersDTO newUsers)
 {
     using (var db = new SqlConnection(_connectionString))
     {
         var sql = @"INSERT INTO [Users]
                   ([FName]
                   ,[MInitial]
                   ,[LName]
                   ,[Phone]
                   ,[Street]
                   ,[City]
                   ,[State]
                   ,[Zip]
                   ,[Email]
                   ,[CreditCardNumber]
                   ,[ExpirationDate]
                   ,[SecurityCode]
                   ,[isActive]
                   )
                   output inserted.*
                   VALUES
                   (@FName
                   ,@MInitial
                   ,@LName
                   ,@Phone
                   ,@Street
                   ,@City
                   ,@State
                   ,@Zip
                   ,@Email
                   ,@CreditCardNumber
                   ,@ExpirationDate
                   ,@SecurityCode
                   ,@isActive)";
         return(db.Query <User>(sql, newUsers));
     }
 }
Esempio n. 2
0
        public User AddNewUsers(NewUsersDTO newUser)
        {
            using (var db = new SqlConnection(_connectionString))

            {
                var sql = @"INSERT INTO Users
                                       ([fName]
                                       ,[lName]
                                       ,[Email]
                                       ,[Phone] 
                                       ,[ImgUrl]
                                       ,[Bio]
                                                )
                                    output inserted.*
                                    VALUES
                                       (@fname
                                       ,@lname
                                       ,@email
                                       ,@phone
                                       ,@imgurl
                                       ,@bio)";
                return(db.QueryFirst <User>(sql, newUser));
            }
        }
Esempio n. 3
0
        public IActionResult CreateNewUser(NewUsersDTO newUser)
        {
            var addNewUser = _repo.AddUsers(newUser);

            return(Ok(addNewUser));
        }