Example #1
0
        public WeatherApi weather_thread(string city)
        {
            var myWeatherTask = getWeather(city);

            myWeatherTask.Wait();
            WeatherApi myWeather = myWeatherTask.Result;


            string dataTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");


            var contextOptions = new DbContextOptionsBuilder <WebApplication3Context>()
                                 .UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=WebApplication3Context-6c28e34d-e6cb-4189-9bb9-60ff82f2a08f;Trusted_Connection=True;MultipleActiveResultSets=true")
                                 .Options;
            var context = new WebApplication3Context(contextOptions);

            var weath = new Models.weather();

            weath.name        = myWeather.name;
            weath.temp        = Math.Round(myWeather.main.temp - 273.15, 1);
            weath.datatime    = dataTime;
            weath.description = myWeather.weather[0].description;
            context.Add(weath);
            context.SaveChanges();


            return(myWeather);
        }
Example #2
0
 public MensagemController(WebApplication3Context context)
 {
     _context = context;
 }
 public CategoriesController(WebApplication3Context context)
 {
     _context = context;
 }
Example #4
0
 public TagsController(WebApplication3Context context, IDataRepository <Tags> dataRepository)
 {
     _context = context;
     _repo    = dataRepository;
 }
Example #5
0
 public ComentariosController(WebApplication3Context context)
 {
     _context = context;
 }
Example #6
0
 public TeamsController(WebApplication3Context context)
 {
     _context = context;
 }
Example #7
0
 public PostsController(WebApplication3Context context, IDataRepository <BlogPost> repo)
 {
     _context = context;
     _repo    = repo;
 }
Example #8
0
 public ContractsController(WebApplication3Context context)
 {
     _context = context;
 }
Example #9
0
 public StudentsController(WebApplication3Context context)
 {
     _context = context;
 }
Example #10
0
 public PlayersController(WebApplication3Context context)
 {
     _context = context;
 }
Example #11
0
 public UsersController(WebApplication3Context context, IStringLocalizer <UsersController> localizer)
 {
     _context   = context;
     _localizer = localizer;
 }
 public ImagesController(WebApplication3Context context, IWebHostEnvironment hostEnvironment)
 {
     _context = context;
     this._hostEnvironment = hostEnvironment;
 }
 public MyTablesController(WebApplication3Context context)
 {
     _context = context;
 }