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)); } }
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)); } }
public IActionResult CreateNewUser(NewUsersDTO newUser) { var addNewUser = _repo.AddUsers(newUser); return(Ok(addNewUser)); }