public async Task <IActionResult> UserDonations(UserForDonationDto userForDonationDto) { using (SqlConnection connection = new SqlConnection(configuration.GetConnectionString("DefaultConnection"))) { var values = await connection.QueryAsync <Donations>(String.Format("SELECT * FROM TableDonations WHERE Username like '{0}'", userForDonationDto.Username)); return(Ok(values)); } }
public async Task <IActionResult> UserDonations(UserForDonationDto userForDonationDto) { myList.Clear(); var values = await _context.TableDonations.ToListAsync(); foreach (var item in values) { if (item.Username == userForDonationDto.Username) { myList.Add(item); } } return(Ok(myList)); }