using Microsoft.AspNetCore.Mvc; using Microsoft.Data.SqlClient; namespace WebApplication1 { public class GetListInfo { public static List GetRegion() { Connecthion.SqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand("select NameRegion from Region", Connecthion.SqlConnection); List list = new List(); SqlDataReader reader = sqlCommand.ExecuteReader(); while (reader.Read()) { list.Add(reader.GetString(0)); } Connecthion.SqlConnection.Close(); reader.Close(); return list; } public static List GetReciplentMessage() { Connecthion.SqlConnection.Open(); SqlCommand sqlCommand = new SqlCommand("select RecipientMessage from RecipientMessage", Connecthion.SqlConnection); List list = new List(); SqlDataReader reader = sqlCommand.ExecuteReader(); while (reader.Read()) { list.Add(reader.GetString(0)); } Connecthion.SqlConnection.Close(); reader.Close(); return list; } [HttpPost] public void MyAction(string action) { Console.WriteLine("Негры"); } } }