This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Security.Claims; | |
using System.Threading.Tasks; | |
using BL; | |
using DAL.Models.Identity; | |
using Microsoft.AspNetCore.Authentication; | |
using Microsoft.AspNetCore.Authentication.Cookies; | |
using Microsoft.AspNetCore.Authorization; | |
using Microsoft.AspNetCore.Identity; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.cookie | |
const response = await fetch('https://localhost:5001/weather/GetAllCities', {method: "POST"}); | |
const myJson = await response.json(); | |
console.log(JSON.stringify(myJson)); | |
fetch('https://localhost:5001/weather', {method: "POST"}) | |
.then(response => response.json()) | |
.then(json=> console.log(JSON.stringify(json))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using DAL.Models.Identity; | |
using Microsoft.AspNetCore.Identity; | |
namespace DAL | |
{ | |
public class DatabaseSeed | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddIdentity<User, Role>() | |
.AddEntityFrameworkStores<OpenWeatherDbContext>() | |
.AddUserManager<UserManager>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Identity; | |
namespace DAL.Models.Identity | |
{ | |
public class Role : IdentityRole<int> | |
{ | |
} | |
public class User : IdentityUser<int> | |
{ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dotnet ef migrations script --project DAL --context OpenWeatherDbContext --startup-project OpenWeather --output $(build.artifactstagingdirectory)/db_migrations.sql --idempotent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
using BL; | |
using DAL.Models; | |
using DAL.Query.Abstraction; | |
using DAL.Query.AllCity; | |
using DAL.Repositories.Abstraction; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Hosting; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
namespace BL | |
{ | |
public interface IStatisticService | |
{ | |
Task<double> GetAveragePressureByCityAsync(int cityId); | |
Task<double> GetAverageTemperatureByCityAsync(int cityId); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services.AddHttpClient<IOpenWeatherClient, OpenWeatherClient>(s => | |
{ | |
var options = new OpenWeatherHttpClientOptions(); | |
Configuration.GetSection("OpenWeatherHttpClientOptions").Bind(options); | |
s.BaseAddress = new Uri(options.Url); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
using BackgroundServices.Models; | |
using BackgroundServices.Options; | |
using Microsoft.Extensions.Logging; | |
using Microsoft.Extensions.Options; | |
using Newtonsoft.Json; | |
namespace BackgroundServices.HttpClients | |
{ | |
public interface IOpenWeatherClient |