This repository is wrapper for nagar api used to retrieve public holidays for specific country at specific year.
To start build the project you will need to install Swashbuckle.AspNetCore 4.0.1 Run the following command in Visual studio Package Manager Console :
Install-Package Swashbuckle.AspNetCore -Version 4.0.1
This solution based on MVC design pattern, as Controller layer calls the business logic layer and retrieve object that contains service response and the model in case of success calling. And business logic layer calls the service and bind it's response into model objects, which should be used in view layer (currently there is no view layer, and model binded in response result object).
Controller layer calls the business logic layer, to return model object and assign it inside response object.
AnswerQuestion(int questionNumber)
return anAnswerResponse
object which contains and answer for selected question.GetHolidays(int year, string countryCode)
returnPublicHolidayResponse
which contains list of Holidays for selected country at selected year.GetHolidaysByYear(int year)
returnCountryPublicHolidayResponse
which contains all holidays for all countries at selected year.- Throttle to each controller assigned to be 5 seconds for each call
Business logic layer calls the service layer directly in order to retrieve any data needed while applying any logic
GetMaxHolidaysCountry(int year)
returns the country which contains maximum number of holidays at selected year.GetMaxHolidaysMonthGlobally(int year)
return maximum month contains globally holidays across all countries.GetMaxUniqueHolidaysCountry(int year)
return maximum country that contains holidays that no other country had these holidays.GetCountryPublicHoliday(int year, string countryCode)
return list of holidays for selected country at selected year.GetCountryPublicHolidayByYear(int year)
return list of all holidays across all countries at selected year.
Service layer that calls nager api directly and and return service response that contains response result binded to model object.
GetPublicHolidays(int year, string countryCode)
call nager api withyear
andcountryCode
to return holiday for selected parametersGetPublicHolidaysByYear(int year)
call nager with withyear
and pass all countries codes and return list of countries with list of holidays for each one.
Any utilites class or methods used in application, for example:
Helper.GetCountriesCodes()
return list of countries codes that any layer could use it.Helper.IsCountryCodeValid(string countryCode)
return if thiscountryCode
is valid to pass to service.
- ASP.Net core 2.1.1 - .Net core framework
- Swashbuckle.AspNetCore 4.0.1 - Swagger UI
- nager api Public Holidays API
- MSTest .Net core
- Dependency Injection
- Build friendly view layer with angular 2+ that uses these controllers to view holidays in calendar for selected country and year.
- Provide more business logic functions to list some insights, e.g. most and least countries in holidays, holidays by months in each country, common holidays between two countries and so on.
- Moustafa Attia - Software Engineer .Net/C# - Moustafa Attia
- Request throttling in .NET Core MVC used in ThrottleAttribute.cs