This API set provides three endpoints:
- A CRUD endpoint for city data, allowing users to perform create, read, update, and delete operations to manage city data.
- A weather search endpoint based on latitude and longitude, allowing users to query current weather information for a specified location.
- A search history endpoint, allowing users to view their previous search history.
Using Sql Server as database.
Change database's connection string in appsettings.json
Api description see Docs folder
Demo Video Link
CREATE TABLE Cities(
id UNIQUEIDENTIFIER PRIMARY KEY,
cityname NVARCHAR(255) NOT NULL,
latitude DECIMAL (9,6) NOT NULL,
longitude DECIMAL (9,6) NOT NULL,
temperature DECIMAL (10,2) NOT NULL,
last_modify DATETIME NOT NULL DEFAULT GETDATE()
);
CREATE TABLE weather (
search_time DATETIME NOT NULL DEFAULT GETDATE() PRIMARY KEY ,
latitude DECIMAL(9, 6) NOT NULL,
longitude DECIMAL(9, 6) NOT NULL,
temperature DECIMAL (10, 2) NOT NULL,
descript NVARCHAR(255)
);
CREATE TABLE history(
cityname NVARCHAR(255),
latitude NVARCHAR(20),
longitude NVARCHAR(20),
temperature DECIMAL(10, 2),
last_modify DATETIME,
search_time DATETIME NOT NULL DEFAULT GETDATE()
);