├── .gitignore ├── InterpolSystem.Api ├── Controllers │ ├── ArticlesController.cs │ ├── BaseController.cs │ ├── MissingPeopleController.cs │ └── WantedPeopleController.cs ├── Infrastructure │ └── Filters │ │ └── ValidateUrlIdAttribute.cs ├── InterpolSystem.Api.csproj ├── Program.cs ├── Startup.cs ├── WebConstants.cs ├── appsettings.Development.json └── appsettings.json ├── InterpolSystem.Common ├── InterpolSystem.Common.csproj └── Mapping │ ├── AutoMapperProfile.cs │ ├── IHaveCustomMapping.cs │ └── IMapFrom.cs ├── InterpolSystem.Data ├── DataConstants.cs ├── EntitiesConfigurations │ ├── ArticleConfiguration.cs │ ├── ChargesConfiguration.cs │ ├── ChargesCountriesConfiguration.cs │ ├── CountriesNationalitiesMissingConfiguration.cs │ ├── CountriesNationalitiesWantedConfiguration.cs │ ├── CountryConfiguration.cs │ ├── IdentityParticularsMissingConfiguration.cs │ ├── IdentityParticularsWantedConfiguration.cs │ ├── LanguageConfiguration.cs │ ├── LanguagesMissingConfiguration.cs │ ├── LanguagesWantedConfiguration.cs │ └── SubmitFormConfiguration.cs ├── IData.cs ├── Infrastructure │ └── Extensions │ │ └── ModelBuilderExtensions.cs ├── InterpolDbContext.cs ├── InterpolSystem.Data.csproj ├── Migrations │ ├── 00000000000000_CreateIdentitySchema.Designer.cs │ ├── 00000000000000_CreateIdentitySchema.cs │ ├── 20180329123012_UsersTableAddFirstLastNameAndBirthdate.Designer.cs │ ├── 20180329123012_UsersTableAddFirstLastNameAndBirthdate.cs │ ├── 20180407135930_AddAllNeededTablesForBountyAdministratorPart.Designer.cs │ ├── 20180407135930_AddAllNeededTablesForBountyAdministratorPart.cs │ ├── 20180419070822_AddArticles.Designer.cs │ ├── 20180419070822_AddArticles.cs │ ├── 20180423094435_SubmitFormForWantedMissingPeople.Designer.cs │ ├── 20180423094435_SubmitFormForWantedMissingPeople.cs │ ├── 20180425130014_DateAndFormOptionsAddedToSubmitForm.Designer.cs │ ├── 20180425130014_DateAndFormOptionsAddedToSubmitForm.cs │ ├── 20180426090228_LoggerForStaff.Designer.cs │ ├── 20180426090228_LoggerForStaff.cs │ ├── 20180503195116_BountyHunterIdToSubmitFormToBeChanged.Designer.cs │ ├── 20180503195116_BountyHunterIdToSubmitFormToBeChanged.cs │ ├── 20180506144049_RewardToWanted.Designer.cs │ ├── 20180506144049_RewardToWanted.cs │ ├── 20180518215721_CaughtFieldToWantedPerson.Designer.cs │ ├── 20180518215721_CaughtFieldToWantedPerson.cs │ └── InterpolDbContextModelSnapshot.cs └── Models │ ├── Article.cs │ ├── Charges.cs │ ├── ChargesCountries.cs │ ├── Countinent.cs │ ├── CountriesNationalitiesMissing.cs │ ├── CountriesNationalitiesWanted.cs │ ├── Country.cs │ ├── Enums │ ├── Color.cs │ ├── FormOptions.cs │ └── Gender.cs │ ├── IdentityParticularsMissing.cs │ ├── IdentityParticularsWanted.cs │ ├── Language.cs │ ├── LanguagesMissing.cs │ ├── LanguagesWanted.cs │ ├── LogEmployee.cs │ ├── PhysicalDescription.cs │ ├── SubmitForm.cs │ └── User.cs ├── InterpolSystem.Services ├── Admin │ ├── IAdminUserService.cs │ ├── ILoggerService.cs │ ├── Implementations │ │ ├── AdminUserService.cs │ │ └── LoggerService.cs │ └── Models │ │ ├── AdminUserListingServiceModel.cs │ │ └── LoggerListingServiceModel.cs ├── Blog │ ├── IArticleService.cs │ ├── Implementations │ │ └── ArticleService.cs │ └── Models │ │ ├── ArticlesDetailsServiceModel.cs │ │ └── ArticlesListingsServiceModel.cs ├── BountyAdmin │ ├── IBountyAdminService.cs │ ├── Implementations │ │ └── BountyAdminService.cs │ └── Models │ │ ├── ChargesListingServiceModel.cs │ │ ├── CountryListingServiceModel.cs │ │ ├── LanguageListingServiceModel.cs │ │ └── SubmitFormWantedServiceModel.cs ├── BountyHunter │ ├── IBountyHunterService.cs │ ├── Implementations │ │ └── BountyHunterService.cs │ └── Models │ │ └── HunterSubmittedFormsServiceModel.cs ├── Html │ ├── IHtmlService.cs │ └── Implementations │ │ └── HtmlService.cs ├── IMissingPeopleService.cs ├── IPdfGenerator.cs ├── IService.cs ├── IWantedPeopleService.cs ├── Implementations │ ├── MissingPeopleService.cs │ ├── PdfGenerator.cs │ └── WantedPeopleService.cs ├── InterpolSystem.Services.csproj ├── Models │ ├── MissingPeople │ │ ├── MissingPeopleDetailsServiceModel.cs │ │ └── MissingPeopleListingServiceModel.cs │ └── WantedPeople │ │ ├── WantedPeopleDetailsServiceModel.cs │ │ └── WantedPeopleListingServiceModel.cs └── ServiceConstants.cs ├── InterpolSystem.Test ├── InterpolSystem.Test.csproj ├── Mocks │ ├── RoleManagerMock.cs │ ├── TestServerFixture.cs │ └── UserManagerMock.cs ├── Services │ ├── Blog │ │ └── ArticleServiceTest.cs │ ├── MissingPeopleServiceTest.cs │ └── WantedPeopleServiceTest.cs ├── Tests.cs └── Web │ ├── Areas │ ├── Admin │ │ └── Controllers │ │ │ ├── LoggerControllerTest.cs │ │ │ └── UsersControllerTest.cs │ └── Blog │ │ └── Controllers │ │ └── ArticlesControllerTest.cs │ └── Controllers │ └── MissingPeopleControllerIntegrationTests.cs ├── InterpolSystem.Web ├── .bowerrc ├── Areas │ ├── Admin │ │ ├── Controllers │ │ │ ├── BaseAdminController.cs │ │ │ ├── LoggerController.cs │ │ │ └── UsersController.cs │ │ ├── Models │ │ │ ├── Logger │ │ │ │ └── LoggerPagingViewModel.cs │ │ │ └── Users │ │ │ │ ├── AddRemoveUserToRoleViewModel.cs │ │ │ │ ├── CreateUserFormViewModel.cs │ │ │ │ ├── UserListingsViewModel.cs │ │ │ │ └── UserRolesViewModel.cs │ │ └── Views │ │ │ ├── Logger │ │ │ └── All.cshtml │ │ │ ├── Users │ │ │ ├── Create.cshtml │ │ │ └── Index.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ └── _ViewStart.cshtml │ ├── Blog │ │ ├── Controllers │ │ │ └── ArticlesController.cs │ │ ├── Models │ │ │ └── Articles │ │ │ │ └── PublishArticleFormViewModel.cs │ │ └── Views │ │ │ ├── Articles │ │ │ ├── Create.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Index.cshtml │ │ │ └── _AllArticlesPartial.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ └── _ViewStart.cshtml │ ├── BountyAdmin │ │ ├── Controllers │ │ │ ├── BaseBountyAdminController.cs │ │ │ ├── MissingPeopleController.cs │ │ │ └── WantedPeopleController.cs │ │ ├── Models │ │ │ ├── LanguageAndCountryListingsViewModel.cs │ │ │ ├── MissingPeople │ │ │ │ └── MissingPeopleFormViewModel.cs │ │ │ └── WantedPeople │ │ │ │ ├── ChargeViewModel.cs │ │ │ │ ├── WantedFilteredFormViewModel.cs │ │ │ │ └── WantedPeopleFormViewModel.cs │ │ └── Views │ │ │ ├── MissingPeople │ │ │ ├── Create.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── _MissingPeopleForm.cshtml │ │ │ ├── WantedPeople │ │ │ ├── AddCharge.cshtml │ │ │ ├── Create.cshtml │ │ │ ├── Edit.cshtml │ │ │ ├── ListAllForms.cshtml │ │ │ └── _WantedPeopleForm.cshtml │ │ │ ├── _ViewImports.cshtml │ │ │ └── _ViewStart.cshtml │ └── BountyHunter │ │ ├── Controllers │ │ └── BountyHunterController.cs │ │ └── Views │ │ ├── BountyHunter │ │ └── GetSubmittedForms.cshtml │ │ ├── _ViewImports.cshtml │ │ └── _ViewStart.cshtml ├── Controllers │ ├── AccountController.cs │ ├── BasePeopleController.cs │ ├── HomeController.cs │ ├── ManageController.cs │ ├── MissingPeopleController.cs │ └── WantedPeopleController.cs ├── Infrastructure │ ├── Extensions │ │ ├── ApplicationBuilderExtensions.cs │ │ ├── ControllerExtensions.cs │ │ ├── ServiceCollectionExtensions.cs │ │ ├── StringExtensions.cs │ │ ├── TempDataDictionaryExtensions.cs │ │ └── UrlHelperExtensions.cs │ └── Filters │ │ ├── LogAttribute.cs │ │ └── SubmitFormAttribute.cs ├── InterpolSystem.Web.csproj ├── Models │ ├── Account │ │ ├── ExternalLoginViewModel.cs │ │ ├── ForgotPasswordViewModel.cs │ │ ├── LoginViewModel.cs │ │ ├── LoginWith2faViewModel.cs │ │ ├── LoginWithRecoveryCodeViewModel.cs │ │ ├── RegisterViewModel.cs │ │ └── ResetPasswordViewModel.cs │ ├── ErrorViewModel.cs │ ├── Manage │ │ ├── ChangePasswordViewModel.cs │ │ ├── EnableAuthenticatorViewModel.cs │ │ ├── ExternalLoginsViewModel.cs │ │ ├── IndexViewModel.cs │ │ ├── RemoveLoginViewModel.cs │ │ ├── SetPasswordViewModel.cs │ │ ├── ShowRecoveryCodesViewModel.cs │ │ └── TwoFactorAuthenticationViewModel.cs │ ├── MissingPeople │ │ └── MissingPeoplePageListingModel.cs │ ├── Shared │ │ ├── SearchFormViewModel.cs │ │ └── SubmitFormViewModel.cs │ └── WantedPeople │ │ └── WantedPeoplePageListingModel.cs ├── Program.cs ├── Startup.cs ├── Views │ ├── Account │ │ ├── AccessDenied.cshtml │ │ ├── ConfirmEmail.cshtml │ │ ├── ExternalLogin.cshtml │ │ ├── ForgotPassword.cshtml │ │ ├── ForgotPasswordConfirmation.cshtml │ │ ├── Lockout.cshtml │ │ ├── Login.cshtml │ │ ├── LoginWith2fa.cshtml │ │ ├── LoginWithRecoveryCode.cshtml │ │ ├── Register.cshtml │ │ ├── ResetPassword.cshtml │ │ ├── ResetPasswordConfirmation.cshtml │ │ └── SignedOut.cshtml │ ├── Home │ │ └── Index.cshtml │ ├── Manage │ │ ├── ChangePassword.cshtml │ │ ├── Disable2fa.cshtml │ │ ├── EnableAuthenticator.cshtml │ │ ├── ExternalLogins.cshtml │ │ ├── GenerateRecoveryCodes.cshtml │ │ ├── Index.cshtml │ │ ├── ManageNavPages.cs │ │ ├── ResetAuthenticator.cshtml │ │ ├── SetPassword.cshtml │ │ ├── ShowRecoveryCodes.cshtml │ │ ├── TwoFactorAuthentication.cshtml │ │ ├── _Layout.cshtml │ │ ├── _ManageNav.cshtml │ │ ├── _StatusMessage.cshtml │ │ └── _ViewImports.cshtml │ ├── MissingPeople │ │ ├── Details.cshtml │ │ ├── Index.cshtml │ │ ├── Search.cshtml │ │ └── _MissingPeopleListingsPartial.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── _Layout.cshtml │ │ ├── _LoginPartial.cshtml │ │ └── _ValidationScriptsPartial.cshtml │ ├── WantedPeople │ │ ├── Details.cshtml │ │ ├── Index.cshtml │ │ ├── Search.cshtml │ │ ├── SubmitForm.cshtml │ │ └── _WantedPeopleListingsPartial.cshtml │ ├── _ViewImports.cshtml │ └── _ViewStart.cshtml ├── WebConstants.cs ├── appsettings.Development.json ├── appsettings.json ├── bower.json ├── bundleconfig.json └── wwwroot │ ├── css │ ├── site.css │ └── site.min.css │ ├── favicon.ico │ ├── images │ ├── background-logo.jpg │ ├── banner1.svg │ ├── banner2.svg │ ├── banner3.svg │ ├── banner4.svg │ ├── caught-logo.jpg │ ├── cyber-crime.jpg │ ├── interpol-logo.png │ ├── shoot-logo.jpg │ └── skyscraper-attack.jpg │ ├── js │ ├── site.js │ └── site.min.js │ └── lib │ ├── bootstrap │ ├── .bower.json │ ├── LICENSE │ └── dist │ │ ├── css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap-theme.css.map │ │ ├── bootstrap-theme.min.css │ │ ├── bootstrap-theme.min.css.map │ │ ├── bootstrap.css │ │ ├── bootstrap.css.map │ │ ├── bootstrap.min.css │ │ └── bootstrap.min.css.map │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ │ └── js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ └── npm.js │ ├── jquery-validation-unobtrusive │ ├── .bower.json │ ├── jquery.validate.unobtrusive.js │ └── jquery.validate.unobtrusive.min.js │ ├── jquery-validation │ ├── .bower.json │ ├── LICENSE.md │ └── dist │ │ ├── additional-methods.js │ │ ├── additional-methods.min.js │ │ ├── jquery.validate.js │ │ └── jquery.validate.min.js │ └── jquery │ ├── .bower.json │ ├── LICENSE.txt │ └── dist │ ├── jquery.js │ ├── jquery.min.js │ └── jquery.min.map ├── InterpolSystem.sln ├── LICENSE └── README.md /InterpolSystem.Api/Controllers/ArticlesController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Api.Controllers 2 | { 3 | using Infrastructure.Filters; 4 | using Microsoft.AspNetCore.Mvc; 5 | using Services.Blog; 6 | 7 | using static WebConstants; 8 | 9 | public class ArticlesController : BaseController 10 | { 11 | private readonly IArticleService articleService; 12 | 13 | public ArticlesController(IArticleService articleService) 14 | { 15 | this.articleService = articleService; 16 | } 17 | 18 | [HttpGet] 19 | public IActionResult GetList() 20 | => Ok(this.articleService.All()); 21 | 22 | [HttpGet(ArticleDetails)] 23 | [ValidateUrlId] 24 | public IActionResult GetArticle(int id) 25 | => Ok(this.articleService.ById(id)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /InterpolSystem.Api/Controllers/BaseController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Api.Controllers 2 | { 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | [Route("api/[controller]")] 6 | public class BaseController : Controller 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /InterpolSystem.Api/Controllers/MissingPeopleController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Api.Controllers 2 | { 3 | using Infrastructure.Filters; 4 | using Microsoft.AspNetCore.Mvc; 5 | using Services; 6 | 7 | using static WebConstants; 8 | 9 | public class MissingPeopleController : BaseController 10 | { 11 | private readonly IMissingPeopleService peopleService; 12 | 13 | public MissingPeopleController(IMissingPeopleService peopleService) 14 | { 15 | this.peopleService = peopleService; 16 | } 17 | 18 | [HttpGet(PageNumber)] 19 | [ValidateUrlId] 20 | public IActionResult GetList(int page) 21 | => Ok(this.peopleService.All(page)); 22 | 23 | [HttpGet(PersonDetails)] 24 | [ValidateUrlId] 25 | public IActionResult GetPersonDetails(int id) 26 | => Ok(this.peopleService.GetPerson(id)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /InterpolSystem.Api/Controllers/WantedPeopleController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Api.Controllers 2 | { 3 | using Infrastructure.Filters; 4 | using Microsoft.AspNetCore.Mvc; 5 | using Services; 6 | 7 | using static WebConstants; 8 | 9 | public class WantedPeopleController : BaseController 10 | { 11 | private readonly IWantedPeopleService peopleService; 12 | 13 | public WantedPeopleController(IWantedPeopleService peopleService) 14 | { 15 | this.peopleService = peopleService; 16 | } 17 | 18 | [HttpGet(PageNumber)] 19 | [ValidateUrlId] 20 | public IActionResult GetList(int page) 21 | => Ok(this.peopleService.All(page)); 22 | 23 | [HttpGet(PersonDetails)] 24 | [ValidateUrlId] 25 | public IActionResult GetPersonDetails(int id) 26 | => Ok(this.peopleService.GetPerson(id)); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /InterpolSystem.Api/Infrastructure/Filters/ValidateUrlIdAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Api.Infrastructure.Filters 2 | { 3 | using Microsoft.AspNetCore.Mvc; 4 | using Microsoft.AspNetCore.Mvc.Filters; 5 | using System.Linq; 6 | 7 | public class ValidateUrlIdAttribute : ActionFilterAttribute 8 | { 9 | public override void OnActionExecuting(ActionExecutingContext context) 10 | { 11 | var controller = context.Controller as Controller; 12 | 13 | if (controller == null) 14 | { 15 | return; 16 | } 17 | 18 | var model = context 19 | .ActionArguments 20 | .FirstOrDefault(a => a.Key.Contains("id") || a.Key.Contains("page")) 21 | .Value; 22 | 23 | if (model == null) 24 | { 25 | context.Result = controller.BadRequest(); 26 | return; 27 | } 28 | 29 | if (int.Parse(model.ToString()) <= 0) 30 | { 31 | context.Result = controller.BadRequest(); 32 | } 33 | 34 | base.OnActionExecuting(context); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /InterpolSystem.Api/InterpolSystem.Api.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | 6d3b9f34-6c75-4a82-8a64-0f20fc90bd1e 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /InterpolSystem.Api/Program.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Api 2 | { 3 | using Microsoft.AspNetCore; 4 | using Microsoft.AspNetCore.Hosting; 5 | 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | BuildWebHost(args).Run(); 11 | } 12 | 13 | public static IWebHost BuildWebHost(string[] args) => 14 | WebHost.CreateDefaultBuilder(args) 15 | .UseStartup() 16 | .Build(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /InterpolSystem.Api/Startup.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Api 2 | { 3 | using AutoMapper; 4 | using Common.Mapping; 5 | using Data; 6 | using Microsoft.AspNetCore.Builder; 7 | using Microsoft.AspNetCore.Hosting; 8 | using Microsoft.EntityFrameworkCore; 9 | using Microsoft.Extensions.Configuration; 10 | using Microsoft.Extensions.DependencyInjection; 11 | using Services; 12 | using Services.Blog; 13 | using Services.Blog.Implementations; 14 | using Services.Implementations; 15 | 16 | public class Startup 17 | { 18 | public Startup(IConfiguration configuration) 19 | { 20 | var builder = new ConfigurationBuilder(); 21 | 22 | builder.AddUserSecrets(); 23 | 24 | Configuration = builder.Build(); 25 | 26 | foreach (var item in configuration.AsEnumerable()) 27 | { 28 | Configuration[item.Key] = item.Value; 29 | } 30 | } 31 | 32 | public Startup(IHostingEnvironment env) 33 | { 34 | var builder = new ConfigurationBuilder(); 35 | 36 | if (env.IsDevelopment()) 37 | { 38 | builder.AddUserSecrets(); 39 | } 40 | 41 | Configuration = builder.Build(); 42 | } 43 | 44 | public IConfiguration Configuration { get; } 45 | 46 | public void ConfigureServices(IServiceCollection services) 47 | { 48 | services 49 | .AddDbContext(options => options 50 | .UseSqlServer(Configuration["ConnectionStrings:DefaultConnection"])); 51 | 52 | services.AddAutoMapper(typeof(AutoMapperProfile)); 53 | 54 | services.AddTransient(); 55 | services.AddTransient(); 56 | services.AddTransient(); 57 | 58 | services.AddRouting(routing => routing.LowercaseUrls = true); 59 | 60 | services.AddMvc(); 61 | } 62 | 63 | public void Configure(IApplicationBuilder app, IHostingEnvironment env) 64 | { 65 | if (env.IsDevelopment()) 66 | { 67 | app.UseDeveloperExceptionPage(); 68 | } 69 | 70 | app.UseMvc(); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /InterpolSystem.Api/WebConstants.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Api 2 | { 3 | public class WebConstants 4 | { 5 | public const string PageNumber = "index/{page}"; 6 | public const string UnexistingPage = "Page does not exist."; 7 | 8 | public const string PersonDetails = "details/{id}"; 9 | public const string UnexistingPerson = "The person that you looking for does not exist."; 10 | 11 | public const string ArticleDetails = "details/{id}"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /InterpolSystem.Api/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /InterpolSystem.Api/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "Debug": { 5 | "LogLevel": { 6 | "Default": "Warning" 7 | } 8 | }, 9 | "Console": { 10 | "LogLevel": { 11 | "Default": "Warning" 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /InterpolSystem.Common/InterpolSystem.Common.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /InterpolSystem.Common/Mapping/AutoMapperProfile.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Common.Mapping 2 | { 3 | using AutoMapper; 4 | using System; 5 | using System.Linq; 6 | 7 | public class AutoMapperProfile : Profile 8 | { 9 | private const string CurrentSystemName = "InterpolSystem"; 10 | 11 | public AutoMapperProfile() 12 | { 13 | var allTypes = AppDomain 14 | .CurrentDomain 15 | .GetAssemblies() 16 | .Where(a => a.GetName().Name.Contains(CurrentSystemName)) 17 | .SelectMany(a => a.GetTypes()); 18 | 19 | allTypes 20 | .Where(t => t.IsClass && !t.IsAbstract && t 21 | .GetInterfaces() 22 | .Where(i => i.IsGenericType) 23 | .Select(i => i.GetGenericTypeDefinition()) 24 | .Contains(typeof(IMapFrom<>))) 25 | .Select(t => new 26 | { 27 | Destination = t, 28 | Source = t 29 | .GetInterfaces() 30 | .Where(i => i.IsGenericType) 31 | .Select(i => new 32 | { 33 | Definition = i.GetGenericTypeDefinition(), 34 | Arguments = i.GetGenericArguments() 35 | }) 36 | .Where(i => i.Definition == typeof(IMapFrom<>)) 37 | .SelectMany(i => i.Arguments) 38 | .First() 39 | }) 40 | .ToList() 41 | .ForEach(mapping => this.CreateMap(mapping.Source, mapping.Destination)); 42 | 43 | allTypes 44 | .Where(t => 45 | t.IsClass 46 | && !t.IsAbstract 47 | && typeof(IHaveCustomMapping).IsAssignableFrom(t)) 48 | .Select(Activator.CreateInstance) 49 | .Cast() 50 | .ToList() 51 | .ForEach(mapping => mapping.ConfigureMapping(this)); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /InterpolSystem.Common/Mapping/IHaveCustomMapping.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Common.Mapping 2 | { 3 | using AutoMapper; 4 | 5 | /// 6 | /// custom configuration - describes the binding configs for the specific properties 7 | /// 8 | public interface IHaveCustomMapping 9 | { 10 | void ConfigureMapping(Profile mapper); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /InterpolSystem.Common/Mapping/IMapFrom.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Common.Mapping 2 | { 3 | /// 4 | /// default configuration - binds only the properties with the same names 5 | /// 6 | /// 7 | public interface IMapFrom 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /InterpolSystem.Data/DataConstants.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data 2 | { 3 | public class DataConstants 4 | { 5 | public const int ChargesDescriptionMinLength = 5; 6 | public const int ChargesDescriptionMaxLength = 100; 7 | 8 | public const int ContinentNameMaxLength = 20; 9 | public const int ContinentNameMinLength = 4; 10 | public const int ContinentCodeMaxMinLength = 2; 11 | 12 | public const int CountryCodeMinMaxLength = 2; 13 | public const int CountryNameMaxLength = 50; 14 | public const int CountryNameMinLength = 3; 15 | 16 | public const int IdentityMissingNamesMinLength = 2; 17 | public const int IdentityMissingNamesMaxLength = 100; 18 | public const int IdentityMissingPlaceOfBirthMaxLength = 50; 19 | public const int IdentityMissingPlaceOfBirthMinLength = 3; 20 | public const int IdentityMissingPlaceOfDisappearanceMaxLength = 100; 21 | public const int IdentityMissingPlaceOfDisappearanceMinLength = 3; 22 | 23 | public const int IdentityWantedNamesMinLength = 2; 24 | public const int IdentityWantedNamesMaxLength = 100; 25 | public const int IdentityWantedPlaceOfBirthMaxLength = 50; 26 | public const int IdentityWantedPlaceOfBirthMinLength = 3; 27 | 28 | public const int LanguageMaxLength = 50; 29 | public const int LanguageMinLength = 2; 30 | 31 | public const int PhysicalDescriptionScarsOrMarksMaxLength = 100; 32 | public const int PhysicalDescriptionPcitureMaxLength = 2000; 33 | public const int PhysicalDescriptionPcitureMinLength = 10; 34 | 35 | public const int UserNamesMaxLength = 50; 36 | public const int UserNamesMinLength = 2; 37 | 38 | public const int ArticlesTitleMaxLength = 30; 39 | public const int ArticlesTitleMinLength = 3; 40 | public const int ArticlesContentMaxLength = 5000; 41 | public const int ArticlesContentMinLength = 5; 42 | 43 | public const string DateFormatString = "{0:dd-MM-yyyy}"; 44 | 45 | public const string InvalidDateInThePast = "01/01/1800"; 46 | 47 | public const int MessageMaxLenght = 500; 48 | public const int MessageMinLenght = 5; 49 | 50 | public const int SubjectMaxLength = 30; 51 | public const int SubjectMinLength = 5; 52 | 53 | public const int PoliceDepartmentMaxLength = 50; 54 | 55 | public const int EmailMaxLength = 50; 56 | 57 | 58 | 59 | public const int ImageMaxSize = 2 * 1024 * 1024; // 2mb 60 | 61 | public const int LoggerValuesMaxLength = 100; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/ArticleConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class ArticleConfiguration : IEntityTypeConfiguration
8 | { 9 | public void Configure(EntityTypeBuilder
builder) 10 | { 11 | builder 12 | .HasOne(a => a.Author) 13 | .WithMany(au => au.Articles) 14 | .HasForeignKey(a => a.AuthorId); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/ChargesConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class ChargesConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder 12 | .HasMany(ch => ch.CountryWantedAuthorities) 13 | .WithOne(cwa => cwa.Charges) 14 | .HasForeignKey(cwa => cwa.ChargesId); 15 | 16 | builder 17 | .HasOne(ch => ch.IdentityParticularsWanted) 18 | .WithMany(ipw => ipw.Charges) 19 | .HasForeignKey(ch => ch.IdentityParticularsWantedId); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/ChargesCountriesConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class ChargesCountriesConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.HasKey(key => new { key.ChargesId, key.CountryId }); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/CountriesNationalitiesMissingConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class CountriesNationalitiesMissingConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.HasKey(key => new { key.CountryId, key.IdentityParticularsMissingId }); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/CountriesNationalitiesWantedConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class CountriesNationalitiesWantedConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.HasKey(key => new { key.CountryId, key.IdentityParticularsWantedId }); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/CountryConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class CountryConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder 12 | .HasOne(c => c.Countinent) 13 | .WithMany(cs => cs.Countries) 14 | .HasForeignKey(c => c.CountinentId); 15 | 16 | builder 17 | .HasMany(c => c.ChargesCountries) 18 | .WithOne(cc => cc.Country) 19 | .HasForeignKey(cc => cc.CountryId); 20 | 21 | builder 22 | .HasMany(c => c.NationalitiesMissingPeople) 23 | .WithOne(nmp => nmp.Country) 24 | .HasForeignKey(nmp => nmp.CountryId); 25 | 26 | builder 27 | .HasMany(c => c.NationalitiesWantedPeople) 28 | .WithOne(nwp => nwp.Country) 29 | .HasForeignKey(nwp => nwp.CountryId); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/IdentityParticularsMissingConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class IdentityParticularsMissingConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder 12 | .HasOne(ipm => ipm.PhysicalDescription); 13 | 14 | builder 15 | .HasMany(ipm => ipm.Nationalities) 16 | .WithOne(n => n.IdentityParticularsMissing) 17 | .HasForeignKey(n => n.IdentityParticularsMissingId); 18 | 19 | builder 20 | .HasMany(ipm => ipm.SpokenLanguages) 21 | .WithOne(sl => sl.IdentityParticularsMissing) 22 | .HasForeignKey(sl => sl.IdentityParticularsMissingId); 23 | 24 | builder 25 | .HasMany(ipw => ipw.SubmitedForms) 26 | .WithOne(sf => sf.MissingPerson) 27 | .HasForeignKey(sf => sf.IdentityParticularsMissingId) 28 | .IsRequired(false); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/IdentityParticularsWantedConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class IdentityParticularsWantedConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder 12 | .HasOne(ipw => ipw.PhysicalDescription); 13 | 14 | builder 15 | .HasMany(ipw => ipw.Nationalities) 16 | .WithOne(n => n.IdentityParticularsWanted) 17 | .HasForeignKey(n => n.IdentityParticularsWantedId); 18 | 19 | builder 20 | .HasMany(ipw => ipw.SpokenLanguages) 21 | .WithOne(sl => sl.IdentityParticularsWanted) 22 | .HasForeignKey(sl => sl.IdentityParticularsWantedId); 23 | 24 | builder 25 | .HasMany(ipw => ipw.SubmitedForms) 26 | .WithOne(sf => sf.WantedPerson) 27 | .HasForeignKey(sf => sf.IdentityParticularsWantedId) 28 | .IsRequired(false); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/LanguageConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class LanguageConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder 12 | .HasMany(l => l.MissingPeopleLanguages) 13 | .WithOne(mpl => mpl.Language) 14 | .HasForeignKey(mpl => mpl.LanguageId); 15 | 16 | builder 17 | .HasMany(l => l.WantedPeopleLanguages) 18 | .WithOne(wpl => wpl.Language) 19 | .HasForeignKey(wpl => wpl.LanguageId); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/LanguagesMissingConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class LanguagesMissingConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.HasKey(key => new { key.LanguageId, key.IdentityParticularsMissingId }); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/LanguagesWantedConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class LanguagesWantedConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder.HasKey(key => new { key.LanguageId, key.IdentityParticularsWantedId }); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /InterpolSystem.Data/EntitiesConfigurations/SubmitFormConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.EntitiesConfigurations 2 | { 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Metadata.Builders; 5 | using Models; 6 | 7 | public class SubmitFormConfiguration : IEntityTypeConfiguration 8 | { 9 | public void Configure(EntityTypeBuilder builder) 10 | { 11 | builder 12 | .HasOne(f => f.User) 13 | .WithMany(u => u.SubmitForms) 14 | .HasForeignKey(f => f.UserId) 15 | .IsRequired(false); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /InterpolSystem.Data/IData.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data 2 | { 3 | /// 4 | /// it is used in the reflection for adding entity relations 5 | /// 6 | public interface IData 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /InterpolSystem.Data/InterpolSystem.Data.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Migrations/20180419070822_AddArticles.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Migrations 2 | { 3 | using Microsoft.EntityFrameworkCore.Metadata; 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | using System; 6 | 7 | public partial class AddArticles : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.CreateTable( 12 | name: "Articles", 13 | columns: table => new 14 | { 15 | Id = table.Column(nullable: false) 16 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), 17 | AuthorId = table.Column(nullable: true), 18 | Content = table.Column(maxLength: 5000, nullable: false), 19 | PublishDate = table.Column(nullable: false), 20 | Title = table.Column(maxLength: 30, nullable: false) 21 | }, 22 | constraints: table => 23 | { 24 | table.PrimaryKey("PK_Articles", x => x.Id); 25 | table.ForeignKey( 26 | name: "FK_Articles_AspNetUsers_AuthorId", 27 | column: x => x.AuthorId, 28 | principalTable: "AspNetUsers", 29 | principalColumn: "Id", 30 | onDelete: ReferentialAction.Restrict); 31 | }); 32 | 33 | migrationBuilder.CreateIndex( 34 | name: "IX_Articles_AuthorId", 35 | table: "Articles", 36 | column: "AuthorId"); 37 | } 38 | 39 | protected override void Down(MigrationBuilder migrationBuilder) 40 | { 41 | migrationBuilder.DropTable( 42 | name: "Articles"); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Migrations/20180425130014_DateAndFormOptionsAddedToSubmitForm.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Migrations 2 | { 3 | using Microsoft.EntityFrameworkCore.Migrations; 4 | using System; 5 | 6 | public partial class DateAndFormOptionsAddedToSubmitForm : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.AddColumn( 11 | name: "Status", 12 | table: "SubmitForms", 13 | nullable: false, 14 | defaultValue: 0); 15 | 16 | migrationBuilder.AddColumn( 17 | name: "SubmissionDate", 18 | table: "SubmitForms", 19 | nullable: false, 20 | defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); 21 | } 22 | 23 | protected override void Down(MigrationBuilder migrationBuilder) 24 | { 25 | migrationBuilder.DropColumn( 26 | name: "Status", 27 | table: "SubmitForms"); 28 | 29 | migrationBuilder.DropColumn( 30 | name: "SubmissionDate", 31 | table: "SubmitForms"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Migrations/20180426090228_LoggerForStaff.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Migrations 2 | { 3 | using Microsoft.EntityFrameworkCore.Metadata; 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | using System; 6 | 7 | public partial class LoggerForStaff : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.CreateTable( 12 | name: "LogEmployees", 13 | columns: table => new 14 | { 15 | Id = table.Column(nullable: false) 16 | .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), 17 | ActionName = table.Column(maxLength: 100, nullable: false), 18 | ControllerName = table.Column(maxLength: 100, nullable: false), 19 | Date = table.Column(nullable: false), 20 | ExceptionMessage = table.Column(nullable: true), 21 | ExceptionType = table.Column(nullable: true), 22 | IpAddress = table.Column(maxLength: 100, nullable: false), 23 | Username = table.Column(maxLength: 100, nullable: false) 24 | }, 25 | constraints: table => 26 | { 27 | table.PrimaryKey("PK_LogEmployees", x => x.Id); 28 | }); 29 | } 30 | 31 | protected override void Down(MigrationBuilder migrationBuilder) 32 | { 33 | migrationBuilder.DropTable( 34 | name: "LogEmployees"); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Migrations/20180503195116_BountyHunterIdToSubmitFormToBeChanged.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Migrations 2 | { 3 | using Microsoft.EntityFrameworkCore.Migrations; 4 | 5 | public partial class BountyHunterIdToSubmitFormToBeChanged : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "UserId", 11 | table: "SubmitForms", 12 | nullable: true); 13 | 14 | migrationBuilder.CreateIndex( 15 | name: "IX_SubmitForms_UserId", 16 | table: "SubmitForms", 17 | column: "UserId"); 18 | 19 | migrationBuilder.AddForeignKey( 20 | name: "FK_SubmitForms_AspNetUsers_UserId", 21 | table: "SubmitForms", 22 | column: "UserId", 23 | principalTable: "AspNetUsers", 24 | principalColumn: "Id", 25 | onDelete: ReferentialAction.Restrict); 26 | } 27 | 28 | protected override void Down(MigrationBuilder migrationBuilder) 29 | { 30 | migrationBuilder.DropForeignKey( 31 | name: "FK_SubmitForms_AspNetUsers_UserId", 32 | table: "SubmitForms"); 33 | 34 | migrationBuilder.DropIndex( 35 | name: "IX_SubmitForms_UserId", 36 | table: "SubmitForms"); 37 | 38 | migrationBuilder.DropColumn( 39 | name: "UserId", 40 | table: "SubmitForms"); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Migrations/20180506144049_RewardToWanted.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Migrations 2 | { 3 | using Microsoft.EntityFrameworkCore.Migrations; 4 | 5 | public partial class RewardToWanted : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "Reward", 11 | table: "IdentityParticularsWanted", 12 | maxLength: 2147483647, 13 | nullable: false, 14 | defaultValue: 0m); 15 | } 16 | 17 | protected override void Down(MigrationBuilder migrationBuilder) 18 | { 19 | migrationBuilder.DropColumn( 20 | name: "Reward", 21 | table: "IdentityParticularsWanted"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Migrations/20180518215721_CaughtFieldToWantedPerson.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Migrations 2 | { 3 | using Microsoft.EntityFrameworkCore.Migrations; 4 | 5 | public partial class CaughtFieldToWantedPerson : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.AddColumn( 10 | name: "IsCaught", 11 | table: "IdentityParticularsWanted", 12 | nullable: false, 13 | defaultValue: false); 14 | } 15 | 16 | protected override void Down(MigrationBuilder migrationBuilder) 17 | { 18 | migrationBuilder.DropColumn( 19 | name: "IsCaught", 20 | table: "IdentityParticularsWanted"); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/Article.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | using static DataConstants; 7 | 8 | public class Article 9 | { 10 | public int Id { get; set; } 11 | 12 | [Required] 13 | [StringLength(ArticlesTitleMaxLength, MinimumLength = ArticlesTitleMinLength)] 14 | public string Title { get; set; } 15 | 16 | [Required] 17 | [StringLength(ArticlesContentMaxLength, MinimumLength = ArticlesContentMinLength)] 18 | public string Content { get; set; } 19 | 20 | public DateTime PublishDate { get; set; } 21 | 22 | public string AuthorId { get; set; } 23 | 24 | public User Author { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/Charges.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | using static DataConstants; 7 | 8 | public class Charges 9 | { 10 | public int Id { get; set; } 11 | 12 | [Required] 13 | [MaxLength(ChargesDescriptionMaxLength)] 14 | [MinLength(ChargesDescriptionMinLength)] 15 | public string Description { get; set; } 16 | 17 | public int IdentityParticularsWantedId { get; set; } 18 | 19 | public IdentityParticularsWanted IdentityParticularsWanted { get; set; } 20 | 21 | public List CountryWantedAuthorities { get; set; } = new List(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/ChargesCountries.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | public class ChargesCountries 4 | { 5 | public int ChargesId { get; set; } 6 | 7 | public Charges Charges { get; set; } 8 | 9 | public int CountryId { get; set; } 10 | 11 | public Country Country { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/Countinent.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | using static DataConstants; 7 | 8 | public class Countinent 9 | { 10 | public int Id { get; set; } 11 | 12 | [Required] 13 | [MaxLength(ContinentCodeMaxMinLength)] 14 | [MinLength(ContinentCodeMaxMinLength)] 15 | public string Code { get; set; } 16 | 17 | [Required] 18 | [MaxLength(ContinentNameMaxLength)] 19 | [MinLength(ContinentNameMinLength)] 20 | public string Name { get; set; } 21 | 22 | public List Countries { get; set; } = new List(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/CountriesNationalitiesMissing.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | public class CountriesNationalitiesMissing 4 | { 5 | public int CountryId { get; set; } 6 | 7 | public Country Country { get; set; } 8 | 9 | public int IdentityParticularsMissingId { get; set; } 10 | 11 | public IdentityParticularsMissing IdentityParticularsMissing { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/CountriesNationalitiesWanted.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | public class CountriesNationalitiesWanted 4 | { 5 | public int CountryId { get; set; } 6 | 7 | public Country Country { get; set; } 8 | 9 | public int IdentityParticularsWantedId { get; set; } 10 | 11 | public IdentityParticularsWanted IdentityParticularsWanted { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/Country.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | using static DataConstants; 7 | 8 | public class Country 9 | { 10 | public int Id { get; set; } 11 | 12 | [Required] 13 | [MaxLength(CountryCodeMinMaxLength)] 14 | [MinLength(CountryCodeMinMaxLength)] 15 | public string Code { get; set; } 16 | 17 | [Required] 18 | [MaxLength(CountryNameMaxLength)] 19 | [MinLength(CountryNameMinLength)] 20 | public string Name { get; set; } 21 | 22 | public int CountinentId { get; set; } 23 | 24 | public Countinent Countinent { get; set; } 25 | 26 | public List NationalitiesMissingPeople { get; set; } = new List(); 27 | 28 | public List NationalitiesWantedPeople { get; set; } = new List(); 29 | 30 | public List ChargesCountries { get; set; } = new List(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/Enums/Color.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models.Enums 2 | { 3 | public enum Color 4 | { 5 | Red = 0, 6 | Orange = 1, 7 | Yellow = 2, 8 | Green = 3, 9 | Cyan = 4, 10 | Blue = 5, 11 | Indigo = 6, 12 | Violet = 7, 13 | Purple = 8, 14 | Magenta = 9, 15 | Pink = 10, 16 | Brown = 11, 17 | White = 12, 18 | Gray = 13, 19 | Black = 14, 20 | Hazel = 15 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/Enums/FormOptions.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models.Enums 2 | { 3 | public enum FormOptions 4 | { 5 | Unread = 0, 6 | Accepted = 1, 7 | Declined = 2 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/Enums/Gender.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models.Enums 2 | { 3 | public enum Gender 4 | { 5 | Male = 0, 6 | Female = 1, 7 | Unknown = 2 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/IdentityParticularsMissing.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | using Enums; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.ComponentModel.DataAnnotations; 7 | 8 | using static DataConstants; 9 | 10 | public class IdentityParticularsMissing 11 | { 12 | public int Id { get; set; } 13 | 14 | [Required] 15 | [MaxLength(IdentityMissingNamesMaxLength)] 16 | [MinLength(IdentityMissingNamesMinLength)] 17 | public string FirstName { get; set; } 18 | 19 | [Required] 20 | [MaxLength(IdentityMissingNamesMaxLength)] 21 | [MinLength(IdentityMissingNamesMinLength)] 22 | public string LastName { get; set; } 23 | 24 | [MaxLength(IdentityMissingNamesMaxLength)] 25 | public string AllNames { get; set; } 26 | 27 | public Gender Gender { get; set; } 28 | 29 | public DateTime DateOfBirth { get; set; } 30 | 31 | [Required] 32 | [MaxLength(IdentityMissingPlaceOfBirthMaxLength)] 33 | [MinLength(IdentityMissingPlaceOfBirthMinLength)] 34 | public string PlaceOfBirth { get; set; } 35 | 36 | public DateTime DateOfDisappearance { get; set; } 37 | 38 | [Required] 39 | [MaxLength(IdentityMissingPlaceOfDisappearanceMaxLength)] 40 | [MinLength(IdentityMissingPlaceOfDisappearanceMinLength)] 41 | public string PlaceOfDisappearance { get; set; } 42 | 43 | public PhysicalDescription PhysicalDescription { get; set; } 44 | 45 | public List SpokenLanguages { get; set; } = new List(); 46 | 47 | public List Nationalities { get; set; } = new List(); 48 | 49 | public List SubmitedForms { get; set; } = new List(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/IdentityParticularsWanted.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | using Enums; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.ComponentModel.DataAnnotations; 7 | 8 | using static DataConstants; 9 | 10 | public class IdentityParticularsWanted 11 | { 12 | public int Id { get; set; } 13 | 14 | [Required] 15 | [MaxLength(IdentityWantedNamesMaxLength)] 16 | [MinLength(IdentityWantedNamesMinLength)] 17 | public string FirstName { get; set; } 18 | 19 | [Required] 20 | [MaxLength(IdentityWantedNamesMaxLength)] 21 | [MinLength(IdentityWantedNamesMinLength)] 22 | public string LastName { get; set; } 23 | 24 | [MaxLength(IdentityWantedNamesMaxLength)] 25 | public string AllNames { get; set; } 26 | 27 | public Gender Gender { get; set; } 28 | 29 | public DateTime DateOfBirth { get; set; } 30 | 31 | [Required] 32 | [MaxLength(IdentityWantedPlaceOfBirthMaxLength)] 33 | [MinLength(IdentityWantedPlaceOfBirthMinLength)] 34 | public string PlaceOfBirth { get; set; } 35 | 36 | [Required] 37 | [Range(0, double.MaxValue)] 38 | public decimal Reward { get; set; } 39 | 40 | public bool IsCaught { get; set; } 41 | 42 | public PhysicalDescription PhysicalDescription { get; set; } 43 | 44 | public List Charges { get; set; } = new List(); 45 | 46 | public List SpokenLanguages { get; set; } = new List(); 47 | 48 | public List Nationalities { get; set; } = new List(); 49 | 50 | public List SubmitedForms { get; set; } = new List(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/Language.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | using System.Collections.Generic; 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | using static DataConstants; 7 | 8 | public class Language 9 | { 10 | public int Id { get; set; } 11 | 12 | [Required] 13 | [MaxLength(LanguageMaxLength)] 14 | [MinLength(LanguageMinLength)] 15 | public string Name { get; set; } 16 | 17 | public List MissingPeopleLanguages { get; set; } = new List(); 18 | 19 | public List WantedPeopleLanguages { get; set; } = new List(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/LanguagesMissing.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | public class LanguagesMissing 4 | { 5 | public int LanguageId { get; set; } 6 | 7 | public Language Language { get; set; } 8 | 9 | public int IdentityParticularsMissingId { get; set; } 10 | 11 | public IdentityParticularsMissing IdentityParticularsMissing { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/LanguagesWanted.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | public class LanguagesWanted 4 | { 5 | public int LanguageId { get; set; } 6 | 7 | public Language Language { get; set; } 8 | 9 | public int IdentityParticularsWantedId { get; set; } 10 | 11 | public IdentityParticularsWanted IdentityParticularsWanted { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/LogEmployee.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | using System; 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | using static DataConstants; 7 | 8 | public class LogEmployee 9 | { 10 | public int Id { get; set; } 11 | 12 | public DateTime Date { get; set; } 13 | 14 | [Required] 15 | [MaxLength(LoggerValuesMaxLength)] 16 | public string IpAddress { get; set; } 17 | 18 | [Required] 19 | [MaxLength(LoggerValuesMaxLength)] 20 | public string Username { get; set; } 21 | 22 | [Required] 23 | [MaxLength(LoggerValuesMaxLength)] 24 | public string ControllerName { get; set; } 25 | 26 | [Required] 27 | [MaxLength(LoggerValuesMaxLength)] 28 | public string ActionName { get; set; } 29 | 30 | public string ExceptionType { get; set; } 31 | 32 | public string ExceptionMessage { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/PhysicalDescription.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | using Enums; 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | using static DataConstants; 7 | 8 | public class PhysicalDescription 9 | { 10 | public int Id { get; set; } 11 | 12 | [Range(0, double.MaxValue)] 13 | public double Height { get; set; } 14 | 15 | [Range(0, double.MaxValue)] 16 | public double Weight { get; set; } 17 | 18 | public Color HairColor { get; set; } 19 | 20 | public Color EyeColor { get; set; } 21 | 22 | [Required] 23 | [MaxLength(PhysicalDescriptionPcitureMaxLength)] 24 | [MinLength(PhysicalDescriptionPcitureMinLength)] 25 | [RegularExpression(@"^(http|https):\/\/.*$")] 26 | public string PictureUrl { get; set; } 27 | 28 | [MaxLength(PhysicalDescriptionScarsOrMarksMaxLength)] 29 | public string ScarsOrDistinguishingMarks { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/SubmitForm.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | using Enums; 4 | using System; 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | using static DataConstants; 8 | 9 | // to be refactored to separate tables many to many, below is not a good idea but it works so far. 10 | public class SubmitForm 11 | { 12 | public int Id { get; set; } 13 | 14 | public string UserId { get; set; } 15 | 16 | public User User { get; set; } 17 | 18 | public int? IdentityParticularsMissingId { get; set; } 19 | 20 | public IdentityParticularsMissing MissingPerson { get; set; } 21 | 22 | public int? IdentityParticularsWantedId { get; set; } 23 | 24 | public IdentityParticularsWanted WantedPerson { get; set; } 25 | 26 | public string PoliceDepartment { get; set; } 27 | 28 | [Required] 29 | [EmailAddress] 30 | public string SenderEmail { get; set; } 31 | 32 | [Required] 33 | [MaxLength(SubjectMaxLength)] 34 | [MinLength(SubjectMinLength)] 35 | public string Subject { get; set; } 36 | 37 | [Required] 38 | [MaxLength(MessageMaxLenght)] 39 | [MinLength(MessageMinLenght)] 40 | public string Message { get; set; } 41 | 42 | [MaxLength(ImageMaxSize)] 43 | public byte[] PersonImage { get; set; } 44 | 45 | public DateTime SubmissionDate { get; set; } 46 | 47 | public FormOptions Status { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /InterpolSystem.Data/Models/User.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Data.Models 2 | { 3 | using Microsoft.AspNetCore.Identity; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.ComponentModel.DataAnnotations; 7 | using System.ComponentModel.DataAnnotations.Schema; 8 | 9 | using static DataConstants; 10 | 11 | public class User : IdentityUser 12 | { 13 | [Required] 14 | [MaxLength(UserNamesMaxLength)] 15 | [MinLength(UserNamesMinLength)] 16 | public string FirstName { get; set; } 17 | 18 | [Required] 19 | [MaxLength(UserNamesMaxLength)] 20 | [MinLength(UserNamesMinLength)] 21 | public string LastName { get; set; } 22 | 23 | public DateTime DateOfBirth { get; set; } 24 | 25 | public List
Articles { get; set; } = new List
(); 26 | 27 | // to be changed to many to many 28 | public List SubmitForms { get; set; } = new List(); 29 | 30 | [NotMapped] 31 | public List RolesIds { get; set; } = new List(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Admin/IAdminUserService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Admin 2 | { 3 | using Models; 4 | using System.Collections.Generic; 5 | 6 | public interface IAdminUserService 7 | { 8 | IEnumerable All(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Admin/ILoggerService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Admin 2 | { 3 | using Services.Admin.Models; 4 | using System.Collections.Generic; 5 | 6 | public interface ILoggerService 7 | { 8 | IEnumerable All(); 9 | 10 | int Total(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Admin/Implementations/AdminUserService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Admin.Implementations 2 | { 3 | using Data; 4 | using Models; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | 8 | public class AdminUserService : IAdminUserService 9 | { 10 | private readonly InterpolDbContext db; 11 | 12 | public AdminUserService(InterpolDbContext db) 13 | { 14 | this.db = db; 15 | } 16 | 17 | public IEnumerable All() 18 | { 19 | var userRoles = this.db.UserRoles.ToList(); 20 | var roles = this.db.Roles 21 | .Select(r => new 22 | { 23 | r.Id, 24 | r.Name 25 | }) 26 | .ToList(); 27 | 28 | var users = this.db.Users 29 | .Select(u => new AdminUserListingServiceModel 30 | { 31 | Id = u.Id, 32 | Username = u.UserName, 33 | Email = u.Email, 34 | RoleNames = roles 35 | .Where(r => userRoles 36 | .Where(ur => ur.UserId == u.Id) 37 | .Select(ur => ur.RoleId).Contains(r.Id)) 38 | .Select(r => r.Name) 39 | }) 40 | .ToList(); 41 | 42 | return users; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Admin/Implementations/LoggerService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Admin.Implementations 2 | { 3 | using AutoMapper.QueryableExtensions; 4 | using Data; 5 | using Services.Admin.Models; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | 9 | public class LoggerService : ILoggerService 10 | { 11 | private readonly InterpolDbContext db; 12 | 13 | public LoggerService(InterpolDbContext db) 14 | { 15 | this.db = db; 16 | } 17 | 18 | public IEnumerable All() 19 | => this.db.LogEmployees 20 | .OrderByDescending(l => l.Id) 21 | .ProjectTo() 22 | .ToList(); 23 | 24 | public int Total() => this.db.LogEmployees.Count(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Admin/Models/AdminUserListingServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Admin.Models 2 | { 3 | using System.Collections.Generic; 4 | 5 | public class AdminUserListingServiceModel 6 | { 7 | public string Id { get; set; } 8 | 9 | public string Username { get; set; } 10 | 11 | public string Email { get; set; } 12 | 13 | public IEnumerable RoleNames { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Admin/Models/LoggerListingServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Admin.Models 2 | { 3 | using Common.Mapping; 4 | using Data.Models; 5 | using System; 6 | 7 | public class LoggerListingServiceModel : IMapFrom 8 | { 9 | public DateTime Date { get; set; } 10 | 11 | public string IpAddress { get; set; } 12 | 13 | public string Username { get; set; } 14 | 15 | public string ControllerName { get; set; } 16 | 17 | public string ActionName { get; set; } 18 | 19 | public string ExceptionType { get; set; } 20 | 21 | public string ExceptionMessage { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Blog/IArticleService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Blog 2 | { 3 | using Models; 4 | using System.Collections.Generic; 5 | 6 | public interface IArticleService 7 | { 8 | void Create(string title, string content, string authorId); 9 | 10 | IEnumerable All(); 11 | 12 | ArticlesDetailsServiceModel ById(int id); 13 | 14 | IEnumerable LastSixArticles(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Blog/Implementations/ArticleService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Blog.Implementations 2 | { 3 | using AutoMapper.QueryableExtensions; 4 | using Data; 5 | using Data.Models; 6 | using Models; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | 11 | using static ServiceConstants; 12 | 13 | public class ArticleService : IArticleService 14 | { 15 | private readonly InterpolDbContext db; 16 | 17 | public ArticleService(InterpolDbContext db) 18 | { 19 | this.db = db; 20 | } 21 | 22 | public void Create(string title, string content, string authorId) 23 | { 24 | if (string.IsNullOrEmpty(title) 25 | || string.IsNullOrEmpty(content) 26 | || string.IsNullOrEmpty(authorId)) 27 | { 28 | throw new InvalidOperationException(InvalidInsertedData); 29 | } 30 | 31 | var article = new Article 32 | { 33 | Title = title, 34 | Content = content, 35 | PublishDate = DateTime.UtcNow, 36 | AuthorId = authorId 37 | }; 38 | 39 | this.db.Articles.Add(article); 40 | this.db.SaveChanges(); 41 | } 42 | 43 | public IEnumerable All() 44 | => this.db.Articles 45 | .OrderByDescending(a => a.Id) 46 | .ProjectTo() 47 | .ToList(); 48 | 49 | public ArticlesDetailsServiceModel ById(int id) 50 | => this.db.Articles 51 | .Where(a => a.Id == id) 52 | .ProjectTo() 53 | .FirstOrDefault(); 54 | 55 | public IEnumerable LastSixArticles() 56 | => this.db.Articles 57 | .OrderByDescending(a => a.Id) 58 | .Take(6) 59 | .ProjectTo() 60 | .ToList(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Blog/Models/ArticlesDetailsServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Blog.Models 2 | { 3 | using AutoMapper; 4 | using Common.Mapping; 5 | using Data.Models; 6 | using System; 7 | 8 | public class ArticlesDetailsServiceModel : IMapFrom
, IHaveCustomMapping 9 | { 10 | public string Title { get; set; } 11 | 12 | public string Content { get; set; } 13 | 14 | public DateTime PublishDate { get; set; } 15 | 16 | public string AuthorName { get; set; } 17 | 18 | public void ConfigureMapping(Profile mapper) 19 | => mapper 20 | .CreateMap() 21 | .ForMember(b => b.AuthorName, cfg => cfg.MapFrom(a => a.Author.UserName)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Blog/Models/ArticlesListingsServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Blog.Models 2 | { 3 | using AutoMapper; 4 | using Common.Mapping; 5 | using Data.Models; 6 | using System; 7 | 8 | public class ArticlesListingsServiceModel : IMapFrom
, IHaveCustomMapping 9 | { 10 | public int Id { get; set; } 11 | 12 | public string Title { get; set; } 13 | 14 | public DateTime PublishDate { get; set; } 15 | 16 | public string AuthorName { get; set; } 17 | 18 | public void ConfigureMapping(Profile mapper) 19 | => mapper 20 | .CreateMap() 21 | .ForMember(s => s.AuthorName, cfg => cfg.MapFrom(a => a.Author.UserName)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /InterpolSystem.Services/BountyAdmin/Models/ChargesListingServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.BountyAdmin.Models 2 | { 3 | using Common.Mapping; 4 | using Data.Models; 5 | 6 | public class ChargesListingServiceModel : IMapFrom 7 | { 8 | public int Id { get; set; } 9 | 10 | public string Description { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /InterpolSystem.Services/BountyAdmin/Models/CountryListingServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.BountyAdmin.Models 2 | { 3 | using Common.Mapping; 4 | using Data.Models; 5 | 6 | public class CountryListingServiceModel : IMapFrom 7 | { 8 | public int Id { get; set; } 9 | 10 | public string Name { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /InterpolSystem.Services/BountyAdmin/Models/LanguageListingServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.BountyAdmin.Models 2 | { 3 | using Common.Mapping; 4 | using Data.Models; 5 | 6 | public class LanguageListingServiceModel : IMapFrom 7 | { 8 | public int Id { get; set; } 9 | 10 | public string Name { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /InterpolSystem.Services/BountyAdmin/Models/SubmitFormWantedServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.BountyAdmin.Models 2 | { 3 | using Common.Mapping; 4 | using Data.Models; 5 | using Data.Models.Enums; 6 | using System; 7 | 8 | public class SubmitFormWantedServiceModel : IMapFrom 9 | { 10 | public int Id { get; set; } 11 | 12 | public int? IdentityParticularsWantedId { get; set; } 13 | 14 | public string PoliceDepartment { get; set; } 15 | 16 | public string SenderEmail { get; set; } 17 | 18 | public string Subject { get; set; } 19 | 20 | public string Message { get; set; } 21 | 22 | public byte[] PersonImage { get; set; } 23 | 24 | public DateTime SubmissionDate { get; set; } 25 | 26 | public FormOptions Status { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /InterpolSystem.Services/BountyHunter/IBountyHunterService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.BountyHunter 2 | { 3 | using Models; 4 | using System.Collections.Generic; 5 | 6 | public interface IBountyHunterService 7 | { 8 | byte[] GetPdfCertificate(int wantedPersonId, string firstLastName, string hunterEmail); 9 | 10 | IEnumerable GetSubmittedForms(string currentUserId); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /InterpolSystem.Services/BountyHunter/Implementations/BountyHunterService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.BountyHunter.Implementations 2 | { 3 | using AutoMapper.QueryableExtensions; 4 | using Data; 5 | using Data.Models.Enums; 6 | using Models; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | 11 | using static ServiceConstants; 12 | 13 | public class BountyHunterService : IBountyHunterService 14 | { 15 | private readonly InterpolDbContext db; 16 | private readonly IPdfGenerator pdfGenerator; 17 | 18 | public BountyHunterService( 19 | InterpolDbContext db, 20 | IPdfGenerator pdfGenerator) 21 | { 22 | this.db = db; 23 | this.pdfGenerator = pdfGenerator; 24 | } 25 | 26 | public byte[] GetPdfCertificate(int wantedPersonId, string firstLastName, string hunterEmail) 27 | { 28 | var certificateInfo = this.db.SubmitForms 29 | .Where(f => f.IdentityParticularsWantedId == wantedPersonId 30 | && f.SenderEmail == hunterEmail 31 | && f.Status == FormOptions.Accepted) 32 | .Select(f => new 33 | { 34 | HunterNames = firstLastName, 35 | DateOfSubmission = f.SubmissionDate, 36 | DateOfIssued = DateTime.UtcNow, 37 | ByPoliceDepartment = f.PoliceDepartment, 38 | CoughtPersonNames = f.WantedPerson.FirstName + " " + f.WantedPerson.LastName 39 | }) 40 | .FirstOrDefault(); 41 | 42 | return this.pdfGenerator.GeneratePdfFromHtml( 43 | string.Format( 44 | PdfCertificateFormat, 45 | certificateInfo.HunterNames, 46 | certificateInfo.DateOfIssued, 47 | certificateInfo.DateOfSubmission, 48 | certificateInfo.ByPoliceDepartment, 49 | certificateInfo.CoughtPersonNames)); 50 | } 51 | 52 | public IEnumerable GetSubmittedForms(string currentUserId) 53 | => this.db.SubmitForms 54 | .Where(f => f.UserId == currentUserId) 55 | .ProjectTo() 56 | .ToList(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /InterpolSystem.Services/BountyHunter/Models/HunterSubmittedFormsServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.BountyHunter.Models 2 | { 3 | using Common.Mapping; 4 | using Data.Models; 5 | using Data.Models.Enums; 6 | using System; 7 | 8 | public class HunterSubmittedFormsServiceModel : IMapFrom 9 | { 10 | public int? IdentityParticularsWantedId { get; set; } 11 | 12 | public string PoliceDepartment { get; set; } 13 | 14 | public string Subject { get; set; } 15 | 16 | public string Message { get; set; } 17 | 18 | public DateTime SubmissionDate { get; set; } 19 | 20 | public FormOptions Status { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Html/IHtmlService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Html 2 | { 3 | public interface IHtmlService 4 | { 5 | string Sanitize(string htmlText); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Html/Implementations/HtmlService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Html.Implementations 2 | { 3 | using Ganss.XSS; 4 | 5 | public class HtmlService : IHtmlService 6 | { 7 | private readonly IHtmlSanitizer htmlSanitizer; 8 | 9 | public HtmlService() 10 | { 11 | this.htmlSanitizer = new HtmlSanitizer(); 12 | this.htmlSanitizer.AllowedAttributes.Add("class"); 13 | } 14 | 15 | public string Sanitize(string htmlContent) 16 | => this.htmlSanitizer.Sanitize(htmlContent); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /InterpolSystem.Services/IMissingPeopleService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services 2 | { 3 | using Data.Models.Enums; 4 | using Models.MissingPeople; 5 | using System.Collections.Generic; 6 | 7 | public interface IMissingPeopleService 8 | { 9 | MissingPeopleDetailsServiceModel GetPerson(int id); 10 | 11 | bool IsPersonExisting(int id); 12 | 13 | int Total(); 14 | 15 | int SearchPeopleCriteriaCounter { get; } 16 | 17 | IEnumerable All(int page = 1, int pageSize = 10); 18 | 19 | IEnumerable SearchByComponents( 20 | bool enableCountrySearch, 21 | int selectedCountry, 22 | bool enableGenderSearch, 23 | Gender selectedGender, 24 | string firstName, 25 | string lastName, 26 | string distinguishMarks, 27 | int age, 28 | int page = 1, 29 | int pageSize = 10); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /InterpolSystem.Services/IPdfGenerator.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services 2 | { 3 | public interface IPdfGenerator 4 | { 5 | byte[] GeneratePdfFromHtml(string html); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /InterpolSystem.Services/IService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services 2 | { 3 | /// 4 | /// it is used in the reflection for adding services 5 | /// 6 | public interface IService 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /InterpolSystem.Services/IWantedPeopleService.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services 2 | { 3 | using Data.Models.Enums; 4 | using Microsoft.AspNetCore.Http; 5 | using Models.WantedPeople; 6 | using System.Collections.Generic; 7 | 8 | public interface IWantedPeopleService 9 | { 10 | WantedPeopleDetailsServiceModel GetPerson(int id); 11 | 12 | int Total(); 13 | 14 | bool IsPersonExisting(int id); 15 | 16 | IEnumerable All(int page = 1, int pageSize = 10); 17 | 18 | void SubmitForm( 19 | int id, 20 | string hunterId, 21 | string policeDepartment, 22 | string subject, 23 | string message, 24 | string senderEmail, 25 | IFormFile image); 26 | 27 | IEnumerable SearchByComponents( 28 | bool enableCountrySearch, 29 | int selectedCountry, 30 | bool enableGenderSearch, 31 | Gender selectedGender, 32 | string firstName, 33 | string lastName, 34 | string distinguishMarks, 35 | int age, 36 | int page = 1, 37 | int pageSize = 10); 38 | 39 | int SearchPeopleCriteriaCounter { get; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Implementations/PdfGenerator.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Implementations 2 | { 3 | using iTextSharp.text; 4 | using iTextSharp.text.html.simpleparser; 5 | using iTextSharp.text.pdf; 6 | using System.IO; 7 | 8 | public class PdfGenerator : IPdfGenerator 9 | { 10 | public byte[] GeneratePdfFromHtml(string html) 11 | { 12 | var pdfDoc = new Document(PageSize.A4, 10f, 10f, 10f, 0f); 13 | var htmlParser = new HtmlWorker(pdfDoc); 14 | 15 | using (var memoryStream = new MemoryStream()) 16 | { 17 | var writer = PdfWriter.GetInstance(pdfDoc, memoryStream); 18 | pdfDoc.Open(); 19 | 20 | using (var stringReader = new StringReader(html)) 21 | { 22 | htmlParser.Parse(stringReader); 23 | } 24 | 25 | pdfDoc.Close(); 26 | 27 | return memoryStream.ToArray(); 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /InterpolSystem.Services/InterpolSystem.Services.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Models/MissingPeople/MissingPeopleDetailsServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Models.MissingPeople 2 | { 3 | using AutoMapper; 4 | using BountyAdmin.Models; 5 | using Common.Mapping; 6 | using Data.Models; 7 | using Data.Models.Enums; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | 12 | public class MissingPeopleDetailsServiceModel : IMapFrom, IHaveCustomMapping 13 | { 14 | public int Id { get; set; } 15 | 16 | public string FirstName { get; set; } 17 | 18 | public string LastName { get; set; } 19 | 20 | public string AllNames { get; set; } 21 | 22 | public Gender Gender { get; set; } 23 | 24 | public DateTime DateOfBirth { get; set; } 25 | 26 | public string PlaceOfBirth { get; set; } 27 | 28 | public DateTime DateOfDisappearance { get; set; } 29 | 30 | public string PlaceOfDisappearance { get; set; } 31 | 32 | public PhysicalDescription PhysicalDescription { get; set; } 33 | 34 | public IEnumerable SpokenLanguages { get; set; } 35 | 36 | public IEnumerable Nationalities { get; set; } 37 | 38 | public void ConfigureMapping(Profile mapper) 39 | => mapper 40 | .CreateMap() 41 | .ForMember(m => m.SpokenLanguages, cfg => cfg.MapFrom(s => s.SpokenLanguages.Select(l => l.Language))) 42 | .ForMember(m => m.Nationalities, cfg => cfg.MapFrom(s => s.Nationalities.Select(n => n.Country))); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Models/MissingPeople/MissingPeopleListingServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Models.MissingPeople 2 | { 3 | using AutoMapper; 4 | using Common.Mapping; 5 | using Data.Models; 6 | using System; 7 | using System.Linq; 8 | 9 | public class MissingPeopleListingServiceModel : IMapFrom, IHaveCustomMapping 10 | { 11 | public int Id { get; set; } 12 | 13 | public string FirstName { get; set; } 14 | 15 | public string LastName { get; set; } 16 | 17 | public DateTime DateOfBirth { get; set; } 18 | 19 | public string GivenNationalities { get; set; } 20 | 21 | public string PictureUrl { get; set; } 22 | 23 | public void ConfigureMapping(Profile mapper) 24 | => mapper 25 | .CreateMap() 26 | .ForMember(mp => mp.GivenNationalities, cfg => cfg.MapFrom(ipm => ipm.Nationalities.Select(n => n.Country.Name).FirstOrDefault())) 27 | .ForMember(mp => mp.PictureUrl, cfg => cfg.MapFrom(ipm => ipm.PhysicalDescription.PictureUrl)); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Models/WantedPeople/WantedPeopleDetailsServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Models.WantedPeople 2 | { 3 | using AutoMapper; 4 | using BountyAdmin.Models; 5 | using Common.Mapping; 6 | using Data.Models; 7 | using Data.Models.Enums; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | 12 | public class WantedPeopleDetailsServiceModel : IMapFrom, IHaveCustomMapping 13 | { 14 | public int Id { get; set; } 15 | 16 | public string FirstName { get; set; } 17 | 18 | public string LastName { get; set; } 19 | 20 | public string AllNames { get; set; } 21 | 22 | public Gender Gender { get; set; } 23 | 24 | public DateTime DateOfBirth { get; set; } 25 | 26 | public string PlaceOfBirth { get; set; } 27 | 28 | public decimal Reward { get; set; } 29 | 30 | public bool IsCaught { get; set; } 31 | 32 | public PhysicalDescription PhysicalDescription { get; set; } 33 | 34 | public IEnumerable SpokenLanguages { get; set; } 35 | 36 | public IEnumerable Nationalities { get; set; } 37 | 38 | public IEnumerable Charges { get; set; } 39 | 40 | public void ConfigureMapping(Profile mapper) 41 | => mapper 42 | .CreateMap() 43 | .ForMember(m => m.SpokenLanguages, cfg => cfg.MapFrom(s => s.SpokenLanguages.Select(l => l.Language))) 44 | .ForMember(m => m.Nationalities, cfg => cfg.MapFrom(s => s.Nationalities.Select(n => n.Country))); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /InterpolSystem.Services/Models/WantedPeople/WantedPeopleListingServiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services.Models.WantedPeople 2 | { 3 | using AutoMapper; 4 | using Common.Mapping; 5 | using Data.Models; 6 | using System; 7 | using System.Linq; 8 | 9 | public class WantedPeopleListingServiceModel : IMapFrom, IHaveCustomMapping 10 | { 11 | public int Id { get; set; } 12 | 13 | public string FirstName { get; set; } 14 | 15 | public string LastName { get; set; } 16 | 17 | public DateTime DateOfBirth { get; set; } 18 | 19 | public string GivenNationalities { get; set; } 20 | 21 | public string PictureUrl { get; set; } 22 | 23 | public bool IsCaught { get; set; } 24 | 25 | public void ConfigureMapping(Profile mapper) 26 | => mapper 27 | .CreateMap() 28 | .ForMember(mp => mp.GivenNationalities, cfg => cfg.MapFrom(ipm => ipm.Nationalities.Select(n => n.Country.Name).FirstOrDefault())) 29 | .ForMember(mp => mp.PictureUrl, cfg => cfg.MapFrom(ipm => ipm.PhysicalDescription.PictureUrl)); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /InterpolSystem.Services/ServiceConstants.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Services 2 | { 3 | public class ServiceConstants 4 | { 5 | public const string InvalidInsertedData = "Invalid data."; 6 | public const string InvalidInsertedPerson = "Invalid person."; 7 | 8 | public const string InvalidFormInfo = "Invalid submitted form."; 9 | 10 | public const string PdfCertificateFormat = @" 11 |

Certificate proving catch of criminal

12 |
13 |

To {0}

14 |
15 |

Date of issue: {1}

16 |

Date of submission {2}

17 |

This certificate proves catch of criminal named : 18 | {4} this criminal was escorted to {3} 19 | police department. In the name of Interpol we are kindly thanking you 20 | for your contribution. 21 |

22 |
23 | Thank you 24 |
Admiral of Interpoll 25 |
Tarim Abzhal 26 |
27 |
28 | "; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /InterpolSystem.Test/InterpolSystem.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /InterpolSystem.Test/Mocks/RoleManagerMock.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Test.Mocks 2 | { 3 | using Microsoft.AspNetCore.Identity; 4 | using Moq; 5 | 6 | public class RoleManagerMock 7 | { 8 | public static Mock> New 9 | => new Mock>( 10 | Mock.Of>(), null, null, null, null); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /InterpolSystem.Test/Mocks/TestServerFixture.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Test.Mocks 2 | { 3 | using InterpolSystem.Web; 4 | using Microsoft.AspNetCore.Hosting; 5 | using Microsoft.AspNetCore.TestHost; 6 | using Microsoft.Extensions.PlatformAbstractions; 7 | using System; 8 | using System.IO; 9 | using System.Net.Http; 10 | 11 | public class TestServerFixture : IDisposable 12 | { 13 | // private const string BaseUri = "https://localhost:4368/"; 14 | private readonly TestServer testServer; 15 | 16 | public TestServerFixture() 17 | { 18 | var builder = new WebHostBuilder() 19 | //.UseContentRoot(GetContentRootPath()) 20 | .UseStartup(); 21 | 22 | testServer = new TestServer(builder); 23 | Client = testServer.CreateClient(); 24 | //this.Client.BaseAddress = new Uri(BaseUri); 25 | } 26 | 27 | public HttpClient Client { get; } 28 | 29 | public void Dispose() 30 | { 31 | this.Client?.Dispose(); 32 | testServer?.Dispose(); 33 | } 34 | 35 | //private string GetContentRootPath() 36 | //{ 37 | // var testProjectPath = PlatformServices.Default.Application.ApplicationBasePath; 38 | // var relativePathToHostProject = "../../../../InterpolSystem.Web"; 39 | // return Path.Combine(testProjectPath, relativePathToHostProject); 40 | //} 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /InterpolSystem.Test/Mocks/UserManagerMock.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Test.Mocks 2 | { 3 | using InterpolSystem.Data.Models; 4 | using Microsoft.AspNetCore.Identity; 5 | using Moq; 6 | 7 | public class UserManagerMock 8 | { 9 | public static Mock> New 10 | => new Mock>( 11 | Mock.Of>(), null, null, null, null, null, null, null, null); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /InterpolSystem.Test/Tests.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Test 2 | { 3 | using AutoMapper; 4 | using InterpolSystem.Common.Mapping; 5 | using InterpolSystem.Data; 6 | using Microsoft.EntityFrameworkCore; 7 | using System; 8 | 9 | public class Tests 10 | { 11 | private static bool testsInitialized = false; 12 | 13 | public static void InitializeAutoMapper() 14 | { 15 | if (!testsInitialized) 16 | { 17 | Mapper.Initialize(config => config.AddProfile()); 18 | testsInitialized = true; 19 | } 20 | } 21 | 22 | public static InterpolDbContext GetDatabase() 23 | { 24 | var dbOptions = new DbContextOptionsBuilder() 25 | .UseInMemoryDatabase(Guid.NewGuid().ToString()) 26 | .Options; // create everytime unique name cuz if the name is equal to all methods it will share the database between them 27 | 28 | return new InterpolDbContext(dbOptions); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /InterpolSystem.Test/Web/Areas/Admin/Controllers/LoggerControllerTest.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Test.Web.Areas.Admin.Controllers 2 | { 3 | using FluentAssertions; 4 | using InterpolSystem.Services.Admin; 5 | using InterpolSystem.Services.Admin.Implementations; 6 | using InterpolSystem.Web.Areas.Admin.Controllers; 7 | using InterpolSystem.Web.Areas.Admin.Models.Logger; 8 | using Microsoft.AspNetCore.Authorization; 9 | using Microsoft.AspNetCore.Mvc; 10 | using Moq; 11 | using System.Linq; 12 | using Xunit; 13 | 14 | using static InterpolSystem.Web.WebConstants; 15 | 16 | public class LoggerControllerTest 17 | { 18 | public LoggerControllerTest() 19 | { 20 | Tests.InitializeAutoMapper(); 21 | } 22 | 23 | [Fact] 24 | public void LogerControllerShouldBeInAdminArea() 25 | { 26 | // Arrange 27 | var controller = typeof(LoggerController); 28 | 29 | // Act 30 | var areaAttribute = controller 31 | .GetCustomAttributes(true) 32 | .FirstOrDefault(attr => attr.GetType() == typeof(AreaAttribute)) 33 | as AreaAttribute; 34 | 35 | // Assert 36 | areaAttribute 37 | .Should() 38 | .NotBeNull(); 39 | 40 | areaAttribute.RouteValue 41 | .Should() 42 | .Be(AdminArea); 43 | } 44 | 45 | [Fact] 46 | public void LoggerControllerShouldBeOnlyForAdmins() 47 | { 48 | // Arrange 49 | var controller = typeof(LoggerController); 50 | 51 | // Act 52 | var authorizeAttribute = controller 53 | .GetCustomAttributes(true) 54 | .FirstOrDefault(attr => attr.GetType() == typeof(AuthorizeAttribute)) 55 | as AuthorizeAttribute; 56 | 57 | // Assert 58 | authorizeAttribute 59 | .Should() 60 | .NotBeNull(); 61 | 62 | authorizeAttribute.Roles 63 | .Should() 64 | .Be(AdministratorRole); 65 | } 66 | 67 | [Fact] 68 | public void ShouldReturnTheCorrectViewModel() 69 | { 70 | // Arrange 71 | var loggerService = new Mock().Object; 72 | var controller = new LoggerController(loggerService); 73 | 74 | // Act 75 | var result = controller.All(string.Empty) as ViewResult; 76 | 77 | // Assert 78 | result 79 | .Should() 80 | .NotBeNull(); 81 | 82 | var model = result.As().Model; 83 | 84 | model 85 | .Should() 86 | .BeOfType(); 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /InterpolSystem.Test/Web/Controllers/MissingPeopleControllerIntegrationTests.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Test.Web.Controllers 2 | { 3 | using InterpolSystem.Test.Mocks; 4 | using System.Threading.Tasks; 5 | using Xunit; 6 | 7 | public class MissingPeopleControllerIntegrationTests : IClassFixture 8 | { 9 | private readonly TestServerFixture server; 10 | 11 | public MissingPeopleControllerIntegrationTests(TestServerFixture server) 12 | { 13 | this.server = server; 14 | } 15 | // TODO SERVER CANNOT FIND FOLDERS 16 | //[Fact] 17 | //public async Task IndexPageShouldReturnStatusCode200() 18 | //{ 19 | // var client = this.server.Client; 20 | // var response = await client.GetAsync("/"); 21 | 22 | // response.EnsureSuccessStatusCode(); 23 | //} 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /InterpolSystem.Web/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "wwwroot/lib" 3 | } -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Admin/Controllers/BaseAdminController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.Admin.Controllers 2 | { 3 | using Microsoft.AspNetCore.Authorization; 4 | using Microsoft.AspNetCore.Mvc; 5 | 6 | using static WebConstants; 7 | 8 | [Area(AdminArea)] 9 | [Authorize(Roles = AdministratorRole)] 10 | public abstract class BaseAdminController : Controller 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Admin/Controllers/LoggerController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.Admin.Controllers 2 | { 3 | using Microsoft.AspNetCore.Mvc; 4 | using Models.Logger; 5 | using Services.Admin; 6 | using System; 7 | using System.Linq; 8 | 9 | public class LoggerController : BaseAdminController 10 | { 11 | private const int ValuesPerPage = 7; 12 | private readonly ILoggerService loggerService; 13 | private int currentPageSize = ValuesPerPage; 14 | 15 | public LoggerController(ILoggerService loggerService) 16 | { 17 | this.loggerService = loggerService; 18 | } 19 | 20 | public IActionResult All(string search, int page = 1) 21 | { 22 | var logs = this.loggerService.All(); 23 | 24 | if (!string.IsNullOrWhiteSpace(search)) 25 | { 26 | logs = logs.Where(l => l.Username.ToLower().Contains(search.ToLower())); 27 | this.currentPageSize = logs.Count(); 28 | } 29 | 30 | if (page < 1) 31 | { 32 | page = 1; 33 | } 34 | 35 | logs = logs 36 | .Skip((page - 1) * ValuesPerPage) 37 | .Take(ValuesPerPage); 38 | 39 | return View(new LoggerPagingViewModel 40 | { 41 | Logs = logs, 42 | Search = search, 43 | CurrentPage = page, 44 | TotalPages = (int)Math.Ceiling(this.loggerService.Total() / (double)currentPageSize) 45 | }); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Admin/Models/Logger/LoggerPagingViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.Admin.Models.Logger 2 | { 3 | using Services.Admin.Models; 4 | using System.Collections.Generic; 5 | 6 | public class LoggerPagingViewModel 7 | { 8 | public IEnumerable Logs { get; set; } 9 | 10 | public string Search { get; set; } 11 | 12 | public int TotalPages { get; set; } 13 | 14 | public int CurrentPage { get; set; } 15 | 16 | public int PreviousPage => this.CurrentPage == 1 ? 1 : this.CurrentPage - 1; 17 | 18 | public int NextPage => this.CurrentPage == this.TotalPages ? this.TotalPages : this.CurrentPage + 1; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Admin/Models/Users/AddRemoveUserToRoleViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.Admin.Models.Users 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class AddRemoveUserToRoleViewModel 6 | { 7 | [Required] 8 | public string UserId { get; set; } 9 | 10 | [Required] 11 | public string Role { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Admin/Models/Users/CreateUserFormViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.Admin.Models.Users 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | using static Data.DataConstants; 6 | 7 | public class CreateUserFormViewModel : UserRolesViewModel 8 | { 9 | [Required] 10 | [MaxLength(UserNamesMaxLength)] 11 | [MinLength(UserNamesMinLength, ErrorMessage = "Username must be at least 2 symbols long.")] 12 | [Display(Name = "Username")] 13 | public string UserName { get; set; } 14 | 15 | [Required] 16 | [EmailAddress] 17 | [Display(Name = "Email")] 18 | public string Email { get; set; } 19 | 20 | [Required] 21 | [MaxLength(UserNamesMaxLength)] 22 | [MinLength(UserNamesMinLength, ErrorMessage = "First name must be at least 2 symbols long.")] 23 | [Display(Name = "First name")] 24 | public string FirstName { get; set; } 25 | 26 | [Required] 27 | [MaxLength(UserNamesMaxLength)] 28 | [MinLength(UserNamesMinLength, ErrorMessage = "Last name must be at least 2 symbols long.")] 29 | [Display(Name = "Last name")] 30 | public string LastName { get; set; } 31 | 32 | [Required] 33 | [Display(Name = "Without role")] 34 | public bool WithoutRole { get; set; } 35 | 36 | public string Role { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Admin/Models/Users/UserListingsViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.Admin.Models.Users 2 | { 3 | using Services.Admin.Models; 4 | using System.Collections.Generic; 5 | 6 | public class UserListingsViewModel : UserRolesViewModel 7 | { 8 | public IEnumerable Users { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Admin/Models/Users/UserRolesViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.Admin.Models.Users 2 | { 3 | using Microsoft.AspNetCore.Mvc.Rendering; 4 | using System.Collections.Generic; 5 | 6 | public class UserRolesViewModel 7 | { 8 | public IEnumerable Roles { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Admin/Views/Users/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model CreateUserFormViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Create user"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 |
10 |
11 |
12 |
13 |
14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 |
24 |
25 | 26 | 27 | 28 |
29 |
30 | 31 | 32 | 33 |
34 |
35 | 36 | 37 |
38 |
39 | 40 | 41 |
42 | 43 |
44 |
45 |
46 | 47 | @section Scripts { 48 | @await Html.PartialAsync("_ValidationScriptsPartial") 49 | } 50 | 51 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Admin/Views/Users/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model UserListingsViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "User Administration"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | @foreach (var user in Model.Users) 21 | { 22 | 23 | 24 | 25 | 35 | 49 | 60 | 61 | } 62 | 63 |
UsernameEmailRolesManage RolesUser options
@user.Username@user.Email 26 | @if (user.RoleNames.Any()) 27 | { 28 | @string.Join(", ", user.RoleNames) 29 | } 30 | else 31 | { 32 |

Does not have any roles.

33 | } 34 |
36 |
37 |
38 |
39 | 40 | 41 |
42 |
43 | 44 | 45 |
46 |
47 |
48 |
50 |
51 |
52 |
53 | 54 | 55 | 56 |
57 |
58 |
59 |
-------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Admin/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using InterpolSystem.Web.Areas.Admin.Models.Users 2 | @using InterpolSystem.Web.Areas.Admin.Models.Logger 3 | @using InterpolSystem.Web.Areas.Admin.Controllers 4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 5 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Admin/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Blog/Controllers/ArticlesController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.Blog.Controllers 2 | { 3 | using Data.Models; 4 | using Infrastructure.Extensions; 5 | using Microsoft.AspNetCore.Authorization; 6 | using Microsoft.AspNetCore.Identity; 7 | using Microsoft.AspNetCore.Mvc; 8 | using Models.Articles; 9 | using Services.Blog; 10 | using Services.Html; 11 | using System; 12 | 13 | using static WebConstants; 14 | 15 | [Area(BlogArea)] 16 | [Authorize(Roles = BloggerRole)] 17 | public class ArticlesController : Controller 18 | { 19 | private readonly IArticleService articleService; 20 | private readonly UserManager userManager; 21 | private readonly IHtmlService htmlService; 22 | 23 | public ArticlesController( 24 | IArticleService articleService, 25 | UserManager userManager, 26 | IHtmlService htmlService) 27 | 28 | { 29 | this.articleService = articleService; 30 | this.userManager = userManager; 31 | this.htmlService = htmlService; 32 | } 33 | 34 | [AllowAnonymous] 35 | public IActionResult Index() 36 | => View(this.articleService.All()); 37 | 38 | [AllowAnonymous] 39 | public IActionResult Details(int id) 40 | => this.ViewOrNotFound(this.articleService.ById(id)); 41 | 42 | public IActionResult Create() => View(); 43 | 44 | [HttpPost] 45 | public IActionResult Create(PublishArticleFormViewModel model) 46 | { 47 | var userId = this.userManager.GetUserId(this.User); 48 | 49 | if (userId == null) 50 | { 51 | TempData.AddErrorMessage("The author does not exist."); 52 | return View(); 53 | } 54 | 55 | var sanitizedContent = this.htmlService.Sanitize(model.Content); 56 | 57 | try 58 | { 59 | this.articleService.Create(model.Title, sanitizedContent, userId); 60 | } 61 | catch (InvalidOperationException ex) 62 | { 63 | return BadRequest(ex.Message); 64 | } 65 | catch (Exception ex) 66 | { 67 | return BadRequest(ex.Message); 68 | } 69 | 70 | TempData.AddSuccessMessage("Successfully published."); 71 | 72 | return RedirectToAction(nameof(Index)); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Blog/Models/Articles/PublishArticleFormViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.Blog.Models.Articles 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | using static Data.DataConstants; 6 | 7 | public class PublishArticleFormViewModel 8 | { 9 | [Required] 10 | [StringLength(ArticlesTitleMaxLength, MinimumLength = ArticlesTitleMinLength)] 11 | public string Title { get; set; } 12 | 13 | [Required] 14 | [StringLength(ArticlesContentMaxLength, MinimumLength = ArticlesContentMinLength)] 15 | public string Content { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Blog/Views/Articles/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model PublishArticleFormViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Publish Article"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 | 10 | 22 | 23 |
24 |
25 |
26 |
27 | 28 | 29 | 30 |
31 |
32 | 33 | 34 | 35 |
36 | 37 |
38 |
39 |
40 | 41 | @section Scripts { 42 | @await Html.PartialAsync("_ValidationScriptsPartial") 43 | } 44 | 45 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Blog/Views/Articles/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model ArticlesDetailsServiceModel 2 | 3 | @{ 4 | ViewData["Title"] = Model.Title; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 |

Published by @Model.AuthorName on @Model.PublishDate.ToLocalTime()

10 |
11 | @Html.Raw(Model.Content) 12 | 13 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Blog/Views/Articles/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewData["Title"] = "News"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 |
10 | @await Html.PartialAsync("_AllArticlesPartial.cshtml", Model) 11 |
12 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Blog/Views/Articles/_AllArticlesPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 |
    4 | @foreach (var article in Model) 5 | { 6 |
  • 7 | 8 | @article.Title 9 | 10 |
    11 | published by @article.AuthorName on @article.PublishDate.ToLocalTime() 12 |
  • 13 | } 14 |
-------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Blog/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using InterpolSystem.Services.Blog.Models 2 | @using InterpolSystem.Web.Areas.Blog.Models.Articles 3 | @using InterpolSystem.Web.Infrastructure.Extensions 4 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 5 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/Blog/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyAdmin/Controllers/BaseBountyAdminController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.BountyAdmin.Controllers 2 | { 3 | using Microsoft.AspNetCore.Authorization; 4 | using Microsoft.AspNetCore.Mvc; 5 | using Microsoft.AspNetCore.Mvc.Rendering; 6 | using Services.BountyAdmin; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | 10 | using static WebConstants; 11 | 12 | [Area(BountyAdminArea)] 13 | [Authorize(Roles = WantedMissingPeopleRole + ", " + AdministratorRole)] 14 | public abstract class BaseBountyAdminController : Controller 15 | { 16 | protected readonly IBountyAdminService bountyAdminService; 17 | 18 | protected BaseBountyAdminController(IBountyAdminService bountyAdminService) 19 | { 20 | this.bountyAdminService = bountyAdminService; 21 | } 22 | 23 | protected List GetLanguages() 24 | => this.bountyAdminService.GetLanguagesList() 25 | .Select(r => new SelectListItem 26 | { 27 | Text = r.Name, 28 | Value = r.Id.ToString() 29 | }) 30 | .ToList(); 31 | 32 | protected List GetCountries() 33 | => this.bountyAdminService.GetCountriesList() 34 | .Select(r => new SelectListItem 35 | { 36 | Text = r.Name, 37 | Value = r.Id.ToString() 38 | }) 39 | .ToList(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyAdmin/Models/LanguageAndCountryListingsViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.BountyAdmin.Models 2 | { 3 | using Microsoft.AspNetCore.Mvc.Rendering; 4 | using System.Collections.Generic; 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | public class LanguageAndCountryListingsViewModel 8 | { 9 | [Display(Name = "Spoken languages")] 10 | public IEnumerable Languages { get; set; } 11 | 12 | public IEnumerable SelectedLanguages { get; set; } 13 | 14 | [Display(Name = "Given nationalities")] 15 | public IEnumerable Countries { get; set; } 16 | 17 | public IEnumerable SelectedCountries { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyAdmin/Models/WantedPeople/ChargeViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.BountyAdmin.Models.WantedPeople 2 | { 3 | using Microsoft.AspNetCore.Mvc.Rendering; 4 | using System.Collections.Generic; 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | using static Data.DataConstants; 8 | 9 | public class ChargeViewModel 10 | { 11 | public int WantedPersonId { get; set; } 12 | 13 | [Required] 14 | [MaxLength(ChargesDescriptionMaxLength)] 15 | [MinLength(ChargesDescriptionMinLength)] 16 | [Display(Name = "Charge description")] 17 | public string Description { get; set; } 18 | 19 | [Display(Name = "Accused in countries:")] 20 | public IEnumerable Countries { get; set; } 21 | 22 | public IEnumerable SelectedCountries { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyAdmin/Models/WantedPeople/WantedFilteredFormViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.BountyAdmin.Models.WantedPeople 2 | { 3 | using Services.BountyAdmin.Models; 4 | using System.Collections.Generic; 5 | 6 | public class WantedFilteredFormViewModel 7 | { 8 | public int Type { get; set; } 9 | 10 | public IEnumerable Forms { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyAdmin/Views/MissingPeople/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model MissingPeopleFormViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Add missing person"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 |
10 |
11 | @await Html.PartialAsync("_MissingPeopleForm", Model) 12 |
13 |
14 | 15 | @section Scripts { 16 | @await Html.PartialAsync("_ValidationScriptsPartial") 17 | } 18 | 19 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyAdmin/Views/MissingPeople/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model MissingPeopleFormViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Edit person"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 |
10 |
11 | @Html.Partial("_MissingPeopleForm", Model) 12 |
13 |
14 | 15 | @section Scripts { 16 | @await Html.PartialAsync("_ValidationScriptsPartial") 17 | } 18 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyAdmin/Views/WantedPeople/AddCharge.cshtml: -------------------------------------------------------------------------------- 1 | @model ChargeViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Add Charge"; 5 | } 6 | 7 |

@ViewData["Title"]

8 |
9 |
10 |
11 |
12 | 16 |
17 | 18 | 19 | 20 |
21 |
22 | 23 | 24 | *Hold Ctrl to select multple countries 25 |
26 |
27 | 28 |
29 | 32 | 38 |
39 |
40 |
41 | 42 |
43 | View details 44 |
45 | 46 | @section Scripts { 47 | @await Html.PartialAsync("_ValidationScriptsPartial") 48 | } 49 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyAdmin/Views/WantedPeople/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model WantedPeopleFormViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Add Wanted Person"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 |
10 |
11 | @await Html.PartialAsync("_WantedPeopleForm", Model) 12 |
13 |
14 | 15 | @section Scripts { 16 | @await Html.PartialAsync("_ValidationScriptsPartial") 17 | } 18 | 19 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyAdmin/Views/WantedPeople/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model WantedPeopleFormViewModel 2 | 3 | @{ 4 | ViewData["Title"] = "Edit person"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 |
10 |
11 | @await Html.PartialAsync("_WantedPeopleForm", Model) 12 |
13 |
14 | 15 | @section Scripts { 16 | @await Html.PartialAsync("_ValidationScriptsPartial") 17 | } 18 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyAdmin/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using InterpolSystem.Data.Models.Enums 2 | @using InterpolSystem.Web.Areas.BountyAdmin.Models.MissingPeople 3 | @using InterpolSystem.Web.Areas.BountyAdmin.Models.WantedPeople 4 | @using InterpolSystem.Web.Infrastructure.Extensions 5 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 6 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyAdmin/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyHunter/Controllers/BountyHunterController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Areas.BountyHunter.Controllers 2 | { 3 | using Data.Models; 4 | using Microsoft.AspNetCore.Authorization; 5 | using Microsoft.AspNetCore.Identity; 6 | using Microsoft.AspNetCore.Mvc; 7 | using Services.BountyHunter; 8 | using System.Threading.Tasks; 9 | 10 | using static WebConstants; 11 | 12 | [Area(BountyHunterArea)] 13 | [Authorize(Roles = BountyHunterRole)] 14 | public class BountyHunterController : Controller 15 | { 16 | private readonly IBountyHunterService hunterService; 17 | private readonly UserManager userManager; 18 | 19 | public BountyHunterController( 20 | IBountyHunterService hunterService, 21 | UserManager userManager) 22 | { 23 | this.hunterService = hunterService; 24 | this.userManager = userManager; 25 | } 26 | 27 | public IActionResult GetSubmittedForms() 28 | { 29 | var currentUserId = this.userManager.GetUserId(User); 30 | 31 | if (currentUserId == null) 32 | { 33 | return NotFound(); 34 | } 35 | 36 | var forms = this.hunterService.GetSubmittedForms(currentUserId); 37 | 38 | return View(forms); 39 | } 40 | 41 | public async Task DownloadCertificate(int id) 42 | { 43 | var currentUser = await this.userManager.GetUserAsync(User); 44 | 45 | if (currentUser == null) 46 | { 47 | return NotFound(); 48 | } 49 | 50 | var fullName = $"{currentUser.FirstName} {currentUser.LastName}"; 51 | 52 | var certificateContent = this.hunterService.GetPdfCertificate(id, fullName, currentUser.Email); 53 | 54 | if (certificateContent == null) 55 | { 56 | return BadRequest(); 57 | } 58 | 59 | return File(certificateContent, "application/pdf", "Official-Certificate.pdf"); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyHunter/Views/BountyHunter/GetSubmittedForms.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewData["Title"] = "Submitted forms"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | @foreach (var form in Model) 21 | { 22 | 23 | 24 | 25 | 26 | 27 | 42 | 43 | } 44 | 45 |
Date of submissionSubjectMessagePolice DepartmentStatus
@form.SubmissionDate.ToLocalTime()@form.Subject@form.Message@form.PoliceDepartment 28 | @if (form.Status == FormOptions.Accepted) 29 | { 30 | Congrats! Take your certificate from 31 | here 32 | } 33 | else if (form.Status == FormOptions.Declined) 34 | { 35 |

Your submission was declined.

36 | } 37 | else 38 | { 39 |

Still waiting to be approved.

40 | } 41 |
46 | 47 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyHunter/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using InterpolSystem.Services.BountyHunter.Models 2 | @using InterpolSystem.Data.Models.Enums 3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 4 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Areas/BountyHunter/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Controllers/BasePeopleController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Controllers 2 | { 3 | using Microsoft.AspNetCore.Mvc; 4 | using Microsoft.AspNetCore.Mvc.Rendering; 5 | using Services.BountyAdmin; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | 9 | public abstract class BasePeopleController : Controller 10 | { 11 | private readonly IBountyAdminService bountyAdminService; 12 | 13 | protected BasePeopleController( 14 | IBountyAdminService bountyAdminService) 15 | { 16 | this.bountyAdminService = bountyAdminService; 17 | } 18 | 19 | protected List GetCountries() 20 | => this.bountyAdminService.GetCountriesList() 21 | .Select(r => new SelectListItem 22 | { 23 | Text = r.Name, 24 | Value = r.Id.ToString() 25 | }) 26 | .ToList(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Controllers 2 | { 3 | using Infrastructure.Filters; 4 | using Microsoft.AspNetCore.Mvc; 5 | using Models; 6 | using System.Diagnostics; 7 | 8 | public class HomeController : Controller 9 | { 10 | [SubmitForm] 11 | public IActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public IActionResult About() 17 | { 18 | ViewData["Message"] = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public IActionResult Contact() 24 | { 25 | ViewData["Message"] = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | 30 | public IActionResult Error() 31 | { 32 | return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Controllers/MissingPeopleController.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Controllers 2 | { 3 | using Microsoft.AspNetCore.Mvc; 4 | using Models.MissingPeople; 5 | using Models.Shared; 6 | using Services; 7 | using Services.Blog; 8 | using Services.BountyAdmin; 9 | using System; 10 | 11 | using static WebConstants; 12 | 13 | public class MissingPeopleController : BasePeopleController 14 | { 15 | private readonly IArticleService articleService; 16 | private readonly IMissingPeopleService peopleService; 17 | 18 | public MissingPeopleController( 19 | IArticleService articleService, 20 | IMissingPeopleService peopleService, 21 | IBountyAdminService bountyAdminService) 22 | : base(bountyAdminService) 23 | { 24 | this.peopleService = peopleService; 25 | this.articleService = articleService; 26 | } 27 | 28 | public IActionResult Index(int page = 1) 29 | => View(new MissingPeoplePageListingModel 30 | { 31 | MissingPeople = this.peopleService.All(page, PageSize), 32 | CurrentPage = page, 33 | TotalPages = (int)Math.Ceiling(this.peopleService.Total() / (double)PageSize), 34 | Countries = this.GetCountries(), 35 | Articles = articleService.LastSixArticles() 36 | }); 37 | 38 | public IActionResult Details(int id) 39 | { 40 | var existingPerson = this.peopleService.IsPersonExisting(id); 41 | 42 | if (!existingPerson) 43 | { 44 | return BadRequest(); 45 | } 46 | 47 | var person = this.peopleService.GetPerson(id); 48 | 49 | return View(person); 50 | } 51 | 52 | public IActionResult Search(SearchFormViewModel model, int page = 1) 53 | => View(new MissingPeoplePageListingModel 54 | { 55 | CurrentPage = page, 56 | MissingPeople = this.peopleService.SearchByComponents( 57 | model.EnableCountrySearch, 58 | model.SelectedCountryId ?? 0, 59 | model.EnableGenderSearch, 60 | model.SelectedGender, 61 | model.SearchByFirstName, 62 | model.SearchByLastName, 63 | model.SearchByDistinguishMarks, 64 | model.SearchByAge ?? 0, 65 | page, 66 | PageSize), 67 | SearchCriteriaTotalPages = this.peopleService.SearchPeopleCriteriaCounter, 68 | TotalPages = (int)Math.Ceiling(this.peopleService.SearchPeopleCriteriaCounter / (double)PageSize), 69 | Articles = articleService.LastSixArticles() 70 | }); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Infrastructure/Extensions/ControllerExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Infrastructure.Extensions 2 | { 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | public static class ControllerExtensions 6 | { 7 | public static IActionResult ViewOrNotFound(this Controller controller, object model) 8 | { 9 | if (model == null) 10 | { 11 | return controller.NotFound(); 12 | } 13 | 14 | return controller.View(model); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Infrastructure/Extensions/ServiceCollectionExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Infrastructure.Extensions 2 | { 3 | using Microsoft.Extensions.DependencyInjection; 4 | using Services; 5 | using System.Linq; 6 | using System.Reflection; 7 | 8 | public static class ServiceCollectionExtensions 9 | { 10 | public static IServiceCollection AddDomainServices(this IServiceCollection services) 11 | { 12 | Assembly 13 | .GetAssembly(typeof(IService)) 14 | .GetTypes() 15 | .Where(t => t.IsClass && t.GetInterfaces().Any(i => i.Name == $"I{t.Name}")) 16 | .Select(t => new 17 | { 18 | Interface = t.GetInterface($"I{t.Name}"), 19 | Implementation = t 20 | }) 21 | .ToList() 22 | .ForEach(s => services.AddTransient(s.Interface, s.Implementation)); 23 | 24 | return services; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Infrastructure/Extensions/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Infrastructure.Extensions 2 | { 3 | using System.Text.RegularExpressions; 4 | 5 | public static class StringExtensions 6 | { 7 | public static string ToFriendlyUrl(this string text) 8 | => Regex.Replace(text, @"[^A-Za-z0-9_\.~]+", "-").ToLower(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Infrastructure/Extensions/TempDataDictionaryExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Infrastructure.Extensions 2 | { 3 | using Microsoft.AspNetCore.Mvc.ViewFeatures; 4 | 5 | using static WebConstants; 6 | 7 | public static class TempDataDictionaryExtensions 8 | { 9 | public static void AddErrorMessage(this ITempDataDictionary tempData, string message) 10 | { 11 | tempData[TempDataErrorMessageKey] = message; 12 | } 13 | 14 | public static void AddSuccessMessage(this ITempDataDictionary tempData, string message) 15 | { 16 | tempData[TempDataSuccessMessageKey] = message; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Infrastructure/Extensions/UrlHelperExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Microsoft.AspNetCore.Mvc 2 | { 3 | using InterpolSystem.Web.Controllers; 4 | 5 | public static class UrlHelperExtensions 6 | { 7 | public static string EmailConfirmationLink(this IUrlHelper urlHelper, string userId, string code, string scheme) 8 | { 9 | return urlHelper.Action( 10 | action: nameof(AccountController.ConfirmEmail), 11 | controller: "Account", 12 | values: new { userId, code }, 13 | protocol: scheme); 14 | } 15 | 16 | public static string ResetPasswordCallbackLink(this IUrlHelper urlHelper, string userId, string code, string scheme) 17 | { 18 | return urlHelper.Action( 19 | action: nameof(AccountController.ResetPassword), 20 | controller: "Account", 21 | values: new { userId, code }, 22 | protocol: scheme); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Infrastructure/Filters/SubmitFormAttribute.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Infrastructure.Filters 2 | { 3 | using Data; 4 | using Microsoft.AspNetCore.Mvc; 5 | using Microsoft.AspNetCore.Mvc.Filters; 6 | using Microsoft.Extensions.DependencyInjection; 7 | using System.Linq; 8 | 9 | using static WebConstants; 10 | 11 | public class SubmitFormAttribute : ActionFilterAttribute 12 | { 13 | public override void OnActionExecuting(ActionExecutingContext context) 14 | { 15 | if (!context.ModelState.IsValid) 16 | { 17 | return; 18 | } 19 | 20 | var db = context 21 | .HttpContext 22 | .RequestServices 23 | .GetService(); 24 | 25 | var unreadedForms = db.SubmitForms 26 | .Where(f => f.Status == 0) 27 | .ToList(); 28 | 29 | if (!unreadedForms.Any()) 30 | { 31 | return; 32 | } 33 | 34 | var controller = context.Controller as Controller; 35 | 36 | if (controller == null) 37 | { 38 | return; 39 | } 40 | 41 | controller.ViewData[ValidForm] = unreadedForms.Count; 42 | 43 | base.OnActionExecuting(context); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /InterpolSystem.Web/InterpolSystem.Web.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.0 5 | aspnet-InterpolSystem.Web-7D1A6485-134A-4964-B523-75B20C7B4790 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Account/ExternalLoginViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Account 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class ExternalLoginViewModel 6 | { 7 | [Required] 8 | [EmailAddress] 9 | public string Email { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Account/ForgotPasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Account 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class ForgotPasswordViewModel 6 | { 7 | [Required] 8 | [EmailAddress] 9 | public string Email { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Account/LoginViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Account 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | using static Data.DataConstants; 6 | 7 | public class LoginViewModel 8 | { 9 | [Required] 10 | [MaxLength(UserNamesMaxLength)] 11 | [MinLength(UserNamesMinLength)] 12 | public string Username { get; set; } 13 | 14 | [Required] 15 | [DataType(DataType.Password)] 16 | public string Password { get; set; } 17 | 18 | [Display(Name = "Remember me?")] 19 | public bool RememberMe { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Account/LoginWith2faViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Account 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class LoginWith2faViewModel 6 | { 7 | [Required] 8 | [StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] 9 | [DataType(DataType.Text)] 10 | [Display(Name = "Authenticator code")] 11 | public string TwoFactorCode { get; set; } 12 | 13 | [Display(Name = "Remember this machine")] 14 | public bool RememberMachine { get; set; } 15 | 16 | public bool RememberMe { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Account/LoginWithRecoveryCodeViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Account 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class LoginWithRecoveryCodeViewModel 6 | { 7 | [Required] 8 | [DataType(DataType.Text)] 9 | [Display(Name = "Recovery Code")] 10 | public string RecoveryCode { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Account/RegisterViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Account 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | using static Data.DataConstants; 6 | 7 | public class RegisterViewModel 8 | { 9 | [Required] 10 | [MaxLength(UserNamesMaxLength)] 11 | [MinLength(UserNamesMinLength)] 12 | [Display(Name = "Username")] 13 | public string UserName { get; set; } 14 | 15 | [Required] 16 | [EmailAddress] 17 | [Display(Name = "Email")] 18 | public string Email { get; set; } 19 | 20 | [Required] 21 | [MaxLength(UserNamesMaxLength)] 22 | [MinLength(UserNamesMinLength)] 23 | [Display(Name = "First name")] 24 | public string FirstName { get; set; } 25 | 26 | [Required] 27 | [MaxLength(UserNamesMaxLength)] 28 | [MinLength(UserNamesMinLength)] 29 | [Display(Name = "Last name")] 30 | public string LastName { get; set; } 31 | 32 | [Required] 33 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] 34 | [DataType(DataType.Password)] 35 | [Display(Name = "Password")] 36 | public string Password { get; set; } 37 | 38 | [DataType(DataType.Password)] 39 | [Display(Name = "Confirm password")] 40 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] 41 | public string ConfirmPassword { get; set; } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Account/ResetPasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Account 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class ResetPasswordViewModel 6 | { 7 | [Required] 8 | [EmailAddress] 9 | public string Email { get; set; } 10 | 11 | [Required] 12 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] 13 | [DataType(DataType.Password)] 14 | public string Password { get; set; } 15 | 16 | [DataType(DataType.Password)] 17 | [Display(Name = "Confirm password")] 18 | [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] 19 | public string ConfirmPassword { get; set; } 20 | 21 | public string Code { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/ErrorViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models 2 | { 3 | public class ErrorViewModel 4 | { 5 | public string RequestId { get; set; } 6 | 7 | public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 8 | } 9 | } -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Manage/ChangePasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Manage 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class ChangePasswordViewModel 6 | { 7 | [Required] 8 | [DataType(DataType.Password)] 9 | [Display(Name = "Current password")] 10 | public string OldPassword { get; set; } 11 | 12 | [Required] 13 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] 14 | [DataType(DataType.Password)] 15 | [Display(Name = "New password")] 16 | public string NewPassword { get; set; } 17 | 18 | [DataType(DataType.Password)] 19 | [Display(Name = "Confirm new password")] 20 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 21 | public string ConfirmPassword { get; set; } 22 | 23 | public string StatusMessage { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Manage/EnableAuthenticatorViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Manage 2 | { 3 | using Microsoft.AspNetCore.Mvc.ModelBinding; 4 | using System.ComponentModel.DataAnnotations; 5 | 6 | public class EnableAuthenticatorViewModel 7 | { 8 | [Required] 9 | [StringLength(7, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] 10 | [DataType(DataType.Text)] 11 | [Display(Name = "Verification Code")] 12 | public string Code { get; set; } 13 | 14 | [BindNever] 15 | public string SharedKey { get; set; } 16 | 17 | [BindNever] 18 | public string AuthenticatorUri { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Manage/ExternalLoginsViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Manage 2 | { 3 | using Microsoft.AspNetCore.Authentication; 4 | using Microsoft.AspNetCore.Identity; 5 | using System.Collections.Generic; 6 | 7 | public class ExternalLoginsViewModel 8 | { 9 | public IList CurrentLogins { get; set; } 10 | 11 | public IList OtherLogins { get; set; } 12 | 13 | public bool ShowRemoveButton { get; set; } 14 | 15 | public string StatusMessage { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Manage/IndexViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Manage 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class IndexViewModel 6 | { 7 | public string Username { get; set; } 8 | 9 | public bool IsEmailConfirmed { get; set; } 10 | 11 | [Required] 12 | [EmailAddress] 13 | public string Email { get; set; } 14 | 15 | [Phone] 16 | [Display(Name = "Phone number")] 17 | public string PhoneNumber { get; set; } 18 | 19 | public string StatusMessage { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Manage/RemoveLoginViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Manage 2 | { 3 | public class RemoveLoginViewModel 4 | { 5 | public string LoginProvider { get; set; } 6 | public string ProviderKey { get; set; } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Manage/SetPasswordViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Manage 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | 5 | public class SetPasswordViewModel 6 | { 7 | [Required] 8 | [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] 9 | [DataType(DataType.Password)] 10 | [Display(Name = "New password")] 11 | public string NewPassword { get; set; } 12 | 13 | [DataType(DataType.Password)] 14 | [Display(Name = "Confirm new password")] 15 | [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")] 16 | public string ConfirmPassword { get; set; } 17 | 18 | public string StatusMessage { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Manage/ShowRecoveryCodesViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Manage 2 | { 3 | public class ShowRecoveryCodesViewModel 4 | { 5 | public string[] RecoveryCodes { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Manage/TwoFactorAuthenticationViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Manage 2 | { 3 | public class TwoFactorAuthenticationViewModel 4 | { 5 | public bool HasAuthenticator { get; set; } 6 | 7 | public int RecoveryCodesLeft { get; set; } 8 | 9 | public bool Is2faEnabled { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/MissingPeople/MissingPeoplePageListingModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.MissingPeople 2 | { 3 | using InterpolSystem.Services.Blog.Models; 4 | using Services.Models.MissingPeople; 5 | using Shared; 6 | using System.Collections.Generic; 7 | 8 | public class MissingPeoplePageListingModel : SearchFormViewModel 9 | { 10 | public IEnumerable MissingPeople { get; set; } = new List(); 11 | 12 | public int TotalPages { get; set; } 13 | 14 | public int CurrentPage { get; set; } 15 | 16 | public int PreviousPage => this.CurrentPage == 1 ? 1 : this.CurrentPage - 1; 17 | 18 | public int NextPage => this.CurrentPage == this.TotalPages ? this.TotalPages : this.CurrentPage + 1; 19 | 20 | public IEnumerable Articles { get; set; } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Shared/SearchFormViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Shared 2 | { 3 | using Data.Models.Enums; 4 | using Microsoft.AspNetCore.Mvc.Rendering; 5 | using System.Collections.Generic; 6 | using System.ComponentModel.DataAnnotations; 7 | 8 | public class SearchFormViewModel 9 | { 10 | public string SearchByFirstName { get; set; } 11 | 12 | public string SearchByLastName { get; set; } 13 | 14 | public string SearchByDistinguishMarks { get; set; } 15 | 16 | public int? SearchByAge { get; set; } 17 | 18 | [Display(Name = "Search by Gender")] 19 | public bool EnableGenderSearch { get; set; } 20 | 21 | public Gender SelectedGender { get; set; } 22 | 23 | [Display(Name = "Search by Country")] 24 | public bool EnableCountrySearch { get; set; } 25 | 26 | public IEnumerable Countries { get; set; } 27 | 28 | public int? SelectedCountryId { get; set; } 29 | 30 | public int SearchCriteriaTotalPages { get; set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/Shared/SubmitFormViewModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.Shared 2 | { 3 | 4 | using Microsoft.AspNetCore.Http; 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | using static Data.DataConstants; 8 | 9 | public class SubmitFormViewModel 10 | { 11 | public int Id { get; set; } 12 | 13 | [Required] 14 | [MaxLength(PoliceDepartmentMaxLength)] 15 | public string PoliceDepartment { get; set; } 16 | 17 | [Required] 18 | [MaxLength(SubjectMaxLength)] 19 | [MinLength(SubjectMinLength)] 20 | public string Subject { get; set; } 21 | 22 | [Required] 23 | [MaxLength(MessageMaxLenght)] 24 | [MinLength(MessageMinLenght)] 25 | public string Message { get; set; } 26 | 27 | public IFormFile Image { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Models/WantedPeople/WantedPeoplePageListingModel.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web.Models.WantedPeople 2 | { 3 | using InterpolSystem.Services.Blog.Models; 4 | using Services.Models.WantedPeople; 5 | using Shared; 6 | using System.Collections.Generic; 7 | 8 | public class WantedPeoplePageListingModel : SearchFormViewModel 9 | { 10 | public IEnumerable WantedPeople { get; set; } = new List(); 11 | 12 | public int TotalPages { get; set; } 13 | 14 | public int CurrentPage { get; set; } 15 | 16 | public int PreviousPage => this.CurrentPage == 1 ? 1 : this.CurrentPage - 1; 17 | 18 | public int NextPage => this.CurrentPage == this.TotalPages ? this.TotalPages : this.CurrentPage + 1; 19 | 20 | public IEnumerable Articles {get; set;} 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Program.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web 2 | { 3 | using Microsoft.AspNetCore; 4 | using Microsoft.AspNetCore.Hosting; 5 | 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | BuildWebHost(args).Run(); 11 | } 12 | 13 | public static IWebHost BuildWebHost(string[] args) => 14 | WebHost.CreateDefaultBuilder(args) 15 | .UseStartup() 16 | .Build(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/AccessDenied.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Access denied"; 3 | } 4 | 5 |
6 |

@ViewData["Title"]

7 |

You do not have access to this resource.

8 |
9 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Confirm email"; 3 | } 4 | 5 |

@ViewData["Title"]

6 |
7 |

8 | Thank you for confirming your email. 9 |

10 |
11 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/ExternalLogin.cshtml: -------------------------------------------------------------------------------- 1 | @model ExternalLoginViewModel 2 | @{ 3 | ViewData["Title"] = "Register"; 4 | } 5 | 6 |

@ViewData["Title"]

7 |

Associate your @ViewData["LoginProvider"] account.

8 |
9 | 10 |

11 | You've successfully authenticated with @ViewData["LoginProvider"]. 12 | Please enter an email address for this site below and click the Register button to finish 13 | logging in. 14 |

15 | 16 |
17 |
18 |
19 |
20 |
21 | 22 | 23 | 24 |
25 | 26 |
27 |
28 |
29 | 30 | @section Scripts { 31 | @await Html.PartialAsync("_ValidationScriptsPartial") 32 | } 33 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model ForgotPasswordViewModel 2 | @{ 3 | ViewData["Title"] = "Forgot your password?"; 4 | } 5 | 6 |

@ViewData["Title"]

7 |

Enter your email.

8 |
9 |
10 |
11 |
12 |
13 |
14 | 15 | 16 | 17 |
18 | 19 |
20 |
21 |
22 | 23 | @section Scripts { 24 | @await Html.PartialAsync("_ValidationScriptsPartial") 25 | } 26 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Forgot password confirmation"; 3 | } 4 | 5 |

@ViewData["Title"]

6 |

7 | Please check your email to reset your password. 8 |

9 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/Lockout.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Locked out"; 3 | } 4 | 5 |
6 |

@ViewData["Title"]

7 |

This account has been locked out, please try again later.

8 |
9 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/LoginWith2fa.cshtml: -------------------------------------------------------------------------------- 1 | @model LoginWith2faViewModel 2 | @{ 3 | ViewData["Title"] = "Two-factor authentication"; 4 | } 5 | 6 |

@ViewData["Title"]

7 |
8 |

Your login is protected with an authenticator app. Enter your authenticator code below.

9 |
10 |
11 |
12 | 13 |
14 |
15 | 16 | 17 | 18 |
19 |
20 |
21 | 25 |
26 |
27 |
28 | 29 |
30 |
31 |
32 |
33 |

34 | Don't have access to your authenticator device? You can 35 | log in with a recovery code. 36 |

37 | 38 | @section Scripts { 39 | @await Html.PartialAsync("_ValidationScriptsPartial") 40 | } -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/LoginWithRecoveryCode.cshtml: -------------------------------------------------------------------------------- 1 | @model LoginWithRecoveryCodeViewModel 2 | @{ 3 | ViewData["Title"] = "Recovery code verification"; 4 | } 5 | 6 |

@ViewData["Title"]

7 |
8 |

9 | You have requested to login with a recovery code. This login will not be remembered until you provide 10 | an authenticator app code at login or disable 2FA and login again. 11 |

12 |
13 |
14 |
15 |
16 |
17 | 18 | 19 | 20 |
21 | 22 |
23 |
24 |
25 | 26 | @section Scripts { 27 | @await Html.PartialAsync("_ValidationScriptsPartial") 28 | } -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/Register.cshtml: -------------------------------------------------------------------------------- 1 | @model RegisterViewModel 2 | @{ 3 | ViewData["Title"] = "Register"; 4 | } 5 | 6 |

@ViewData["Title"]

7 | 8 |
9 |
10 |
11 |

Create a new account.

12 |
13 |
14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 |
24 |
25 | 26 | 27 | 28 |
29 |
30 | 31 | 32 | 33 |
34 |
35 | 36 | 37 | 38 |
39 |
40 | 41 | 42 | 43 |
44 | 45 |
46 |
47 |
48 | 49 | @section Scripts { 50 | @await Html.PartialAsync("_ValidationScriptsPartial") 51 | } 52 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/ResetPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model ResetPasswordViewModel 2 | @{ 3 | ViewData["Title"] = "Reset password"; 4 | } 5 | 6 |

@ViewData["Title"]

7 |

Reset your password.

8 |
9 |
10 |
11 |
12 |
13 | 14 |
15 | 16 | 17 | 18 |
19 |
20 | 21 | 22 | 23 |
24 |
25 | 26 | 27 | 28 |
29 | 30 |
31 |
32 |
33 | 34 | @section Scripts { 35 | @await Html.PartialAsync("_ValidationScriptsPartial") 36 | } 37 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Reset password confirmation"; 3 | } 4 | 5 |

@ViewData["Title"]

6 |

7 | Your password has been reset. Please click here to log in. 8 |

9 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Account/SignedOut.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Signed out"; 3 | } 4 | 5 |

@ViewData["Title"]

6 |

7 | You have successfully signed out. 8 |

9 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/ChangePassword.cshtml: -------------------------------------------------------------------------------- 1 | @model ChangePasswordViewModel 2 | @{ 3 | ViewData["Title"] = "Change password"; 4 | ViewData.AddActivePage(ManageNavPages.ChangePassword); 5 | } 6 | 7 |

@ViewData["Title"]

8 | @Html.Partial("_StatusMessage", Model.StatusMessage) 9 |
10 |
11 |
12 |
13 |
14 | 15 | 16 | 17 |
18 |
19 | 20 | 21 | 22 |
23 |
24 | 25 | 26 | 27 |
28 | 29 |
30 |
31 |
32 | 33 | @section Scripts { 34 | @await Html.PartialAsync("_ValidationScriptsPartial") 35 | } 36 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/Disable2fa.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Disable two-factor authentication (2FA)"; 3 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication); 4 | } 5 | 6 |

@ViewData["Title"]

7 | 8 | 19 | 20 |
21 |
22 | 23 |
24 |
25 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/EnableAuthenticator.cshtml: -------------------------------------------------------------------------------- 1 | @model EnableAuthenticatorViewModel 2 | @{ 3 | ViewData["Title"] = "Enable authenticator"; 4 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication); 5 | } 6 | 7 |

@ViewData["Title"]

8 |
9 |

To use an authenticator app go through the following steps:

10 |
    11 |
  1. 12 |

    13 | Download a two-factor authenticator app like Microsoft Authenticator for 14 | Windows Phone, 15 | Android and 16 | iOS or 17 | Google Authenticator for 18 | Android and 19 | iOS. 20 |

    21 |
  2. 22 |
  3. 23 |

    Scan the QR Code or enter this key @Model.SharedKey into your two factor authenticator app. Spaces and casing do not matter.

    24 |
    To enable QR code generation please read our documentation.
    25 |
    26 |
    27 |
  4. 28 |
  5. 29 |

    30 | Once you have scanned the QR code or input the key above, your two factor authentication app will provide you 31 | with a unique code. Enter the code in the confirmation box below. 32 |

    33 |
    34 |
    35 |
    36 |
    37 | 38 | 39 | 40 |
    41 | 42 |
    43 |
    44 |
    45 |
    46 |
  6. 47 |
48 |
49 | 50 | @section Scripts { 51 | @await Html.PartialAsync("_ValidationScriptsPartial") 52 | } 53 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/ExternalLogins.cshtml: -------------------------------------------------------------------------------- 1 | @model ExternalLoginsViewModel 2 | @{ 3 | ViewData["Title"] = "Manage your external logins"; 4 | ViewData.AddActivePage(ManageNavPages.ExternalLogins); 5 | } 6 | 7 | @Html.Partial("_StatusMessage", Model.StatusMessage) 8 | @if (Model.CurrentLogins?.Count > 0) 9 | { 10 |

Registered Logins

11 | 12 | 13 | @foreach (var login in Model.CurrentLogins) 14 | { 15 | 16 | 17 | 33 | 34 | } 35 | 36 |
@login.LoginProvider 18 | @if (Model.ShowRemoveButton) 19 | { 20 |
21 |
22 | 23 | 24 | 25 |
26 |
27 | } 28 | else 29 | { 30 | @:   31 | } 32 |
37 | } 38 | @if (Model.OtherLogins?.Count > 0) 39 | { 40 |

Add another service to log in.

41 |
42 |
43 |
44 |

45 | @foreach (var provider in Model.OtherLogins) 46 | { 47 | 48 | } 49 |

50 |
51 |
52 | } 53 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/GenerateRecoveryCodes.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Generate two-factor authentication (2FA) recovery codes"; 3 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication); 4 | } 5 | 6 |

@ViewData["Title"]

7 | 8 | 21 | 22 |
23 |
24 | 25 |
26 |
27 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IndexViewModel 2 | @{ 3 | ViewData["Title"] = "Profile"; 4 | ViewData.AddActivePage(ManageNavPages.Index); 5 | } 6 | 7 |

@ViewData["Title"]

8 | @Html.Partial("_StatusMessage", Model.StatusMessage) 9 |
10 |
11 |
12 |
13 |
14 | 15 | 16 |
17 |
18 | 19 | @if (Model.IsEmailConfirmed) 20 | { 21 |
22 | 23 | 24 |
25 | } 26 | else 27 | { 28 | 29 | 30 | } 31 | 32 |
33 |
34 | 35 | 36 | 37 |
38 | 39 |
40 |
41 |
42 | 43 | @section Scripts { 44 | @await Html.PartialAsync("_ValidationScriptsPartial") 45 | } 46 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/ManageNavPages.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Mvc.Rendering; 6 | using Microsoft.AspNetCore.Mvc.ViewFeatures; 7 | 8 | namespace InterpolSystem.Web.Views.Manage 9 | { 10 | public static class ManageNavPages 11 | { 12 | public static string ActivePageKey => "ActivePage"; 13 | 14 | public static string Index => "Index"; 15 | 16 | public static string ChangePassword => "ChangePassword"; 17 | 18 | public static string ExternalLogins => "ExternalLogins"; 19 | 20 | public static string TwoFactorAuthentication => "TwoFactorAuthentication"; 21 | 22 | public static string IndexNavClass(ViewContext viewContext) => PageNavClass(viewContext, Index); 23 | 24 | public static string ChangePasswordNavClass(ViewContext viewContext) => PageNavClass(viewContext, ChangePassword); 25 | 26 | public static string ExternalLoginsNavClass(ViewContext viewContext) => PageNavClass(viewContext, ExternalLogins); 27 | 28 | public static string TwoFactorAuthenticationNavClass(ViewContext viewContext) => PageNavClass(viewContext, TwoFactorAuthentication); 29 | 30 | public static string PageNavClass(ViewContext viewContext, string page) 31 | { 32 | var activePage = viewContext.ViewData["ActivePage"] as string; 33 | return string.Equals(activePage, page, StringComparison.OrdinalIgnoreCase) ? "active" : null; 34 | } 35 | 36 | public static void AddActivePage(this ViewDataDictionary viewData, string activePage) => viewData[ActivePageKey] = activePage; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/ResetAuthenticator.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewData["Title"] = "Reset authenticator key"; 3 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication); 4 | } 5 | 6 |

@ViewData["Title"]

7 | 17 |
18 |
19 | 20 |
21 |
-------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/SetPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model SetPasswordViewModel 2 | @{ 3 | ViewData["Title"] = "Set password"; 4 | ViewData.AddActivePage(ManageNavPages.ChangePassword); 5 | } 6 | 7 |

Set your password

8 | @Html.Partial("_StatusMessage", Model.StatusMessage) 9 |

10 | You do not have a local username/password for this site. Add a local 11 | account so you can log in without an external login. 12 |

13 |
14 |
15 |
16 |
17 |
18 | 19 | 20 | 21 |
22 |
23 | 24 | 25 | 26 |
27 | 28 |
29 |
30 |
31 | 32 | @section Scripts { 33 | @await Html.PartialAsync("_ValidationScriptsPartial") 34 | } 35 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/ShowRecoveryCodes.cshtml: -------------------------------------------------------------------------------- 1 | @model ShowRecoveryCodesViewModel 2 | @{ 3 | ViewData["Title"] = "Recovery codes"; 4 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication); 5 | } 6 | 7 |

@ViewData["Title"]

8 | 17 |
18 |
19 | @for (var row = 0; row < Model.RecoveryCodes.Length; row += 2) 20 | { 21 | @Model.RecoveryCodes[row] @Model.RecoveryCodes[row + 1]
22 | } 23 |
24 |
-------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/TwoFactorAuthentication.cshtml: -------------------------------------------------------------------------------- 1 | @model TwoFactorAuthenticationViewModel 2 | @{ 3 | ViewData["Title"] = "Two-factor authentication"; 4 | ViewData.AddActivePage(ManageNavPages.TwoFactorAuthentication); 5 | } 6 | 7 |

@ViewData["Title"]

8 | @if (Model.Is2faEnabled) 9 | { 10 | if (Model.RecoveryCodesLeft == 0) 11 | { 12 |
13 | You have no recovery codes left. 14 |

You must generate a new set of recovery codes before you can log in with a recovery code.

15 |
16 | } 17 | else if (Model.RecoveryCodesLeft == 1) 18 | { 19 |
20 | You have 1 recovery code left. 21 |

You can generate a new set of recovery codes.

22 |
23 | } 24 | else if (Model.RecoveryCodesLeft <= 3) 25 | { 26 |
27 | You have @Model.RecoveryCodesLeft recovery codes left. 28 |

You should generate a new set of recovery codes.

29 |
30 | } 31 | 32 | Disable 2FA 33 | Reset recovery codes 34 | } 35 | 36 |
Authenticator app
37 | @if (!Model.HasAuthenticator) 38 | { 39 | Add authenticator app 40 | } 41 | else 42 | { 43 | Configure authenticator app 44 | Reset authenticator key 45 | } 46 | 47 | @section Scripts { 48 | @await Html.PartialAsync("_ValidationScriptsPartial") 49 | } 50 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/_Layout.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "/Views/Shared/_Layout.cshtml"; 3 | } 4 | 5 |

Manage your account

6 | 7 |
8 |

Change your account settings

9 |
10 |
11 |
12 | @await Html.PartialAsync("_ManageNav") 13 |
14 |
15 | @RenderBody() 16 |
17 |
18 |
19 | 20 | @section Scripts { 21 | @RenderSection("Scripts", required: false) 22 | } 23 | 24 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/_ManageNav.cshtml: -------------------------------------------------------------------------------- 1 | @using InterpolSystem.Web.Views.Manage 2 | @inject SignInManager SignInManager 3 | @{ 4 | var hasExternalLogins = (await SignInManager.GetExternalAuthenticationSchemesAsync()).Any(); 5 | } 6 | 7 | 16 | 17 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/_StatusMessage.cshtml: -------------------------------------------------------------------------------- 1 | @model string 2 | 3 | @if (!String.IsNullOrEmpty(Model)) 4 | { 5 | var statusMessageClass = Model.StartsWith("Error") ? "danger" : "success"; 6 | 10 | } 11 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Manage/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using InterpolSystem.Web.Views.Manage -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/MissingPeople/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model MissingPeoplePageListingModel 2 | 3 | @{ 4 | ViewData["Title"] = "Missing People"; 5 | } 6 | 7 |

@ViewData["Title"]

8 |
9 |
10 |
11 |
12 |
13 | 14 | 15 | 16 | 17 |
18 |
19 |
20 | 21 | 22 | 23 |
24 |
25 | 26 | 27 | 30 |
31 |
32 | 33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | @await Html.PartialAsync("_MissingPeopleListingsPartial", Model) 41 |
42 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/MissingPeople/Search.cshtml: -------------------------------------------------------------------------------- 1 | @model MissingPeoplePageListingModel 2 | 3 | @{ 4 | ViewData["Title"] = "Search results"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 | @if (Model.MissingPeople.Any()) 10 | { 11 |

Found @Model.SearchCriteriaTotalPages matched results.

12 | 13 |
14 | @await Html.PartialAsync("_MissingPeopleListingsPartial", Model) 15 |
16 | } 17 | else 18 | { 19 |

No people to show.

20 | } 21 | 22 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/MissingPeople/_MissingPeopleListingsPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model MissingPeoplePageListingModel 2 | 3 | @{ 4 | var previousDisabled = Model.CurrentPage == 1 ? "disabled" : string.Empty; 5 | var nextDisabled = Model.CurrentPage == Model.TotalPages ? "disabled" : string.Empty; 6 | } 7 | 8 |
9 |
10 | @foreach (var person in Model.MissingPeople) 11 | { 12 |
13 |
14 |
15 | Details 16 |
17 |
18 | 19 |
20 |

21 | @($"Name: {person.FirstName} {person.LastName}") 22 |

23 |

24 | @($"Age today: {DateTime.UtcNow.Year - person.DateOfBirth.Year} years old") 25 |

26 |

27 | @($"Nationality: {person.GivenNationalities}") 28 |

29 |
30 |
31 |
32 | } 33 |
34 |
35 | 36 |

Last News:

37 |
38 |
39 | @await Html.PartialAsync("~/Areas/Blog/Views/Articles/_AllArticlesPartial.cshtml", Model.Articles) 40 |
41 |
42 |
43 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | @{ 3 | ViewData["Title"] = "Error"; 4 | } 5 | 6 |

Error.

7 |

An error occurred while processing your request.

8 | 9 | @if (Model.ShowRequestId) 10 | { 11 |

12 | Request ID: @Model.RequestId 13 |

14 | } 15 | 16 |

Development Mode

17 |

18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |

20 |

21 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. 22 |

23 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Identity 2 | @using InterpolSystem.Web.Models 3 | 4 | @inject SignInManager SignInManager 5 | @inject UserManager UserManager 6 | 7 | @if (SignInManager.IsSignedIn(User)) 8 | { 9 | 19 | } 20 | else 21 | { 22 | 26 | } 27 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/Shared/_ValidationScriptsPartial.cshtml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 12 | 18 | 19 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/WantedPeople/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model WantedPeoplePageListingModel 2 | 3 | @{ 4 | ViewData["Title"] = "Wanted People"; 5 | } 6 | 7 |

@ViewData["Title"]

8 |
9 |
10 |
11 |
12 |
13 | 14 | 15 | 16 | 17 |
18 |
19 |
20 | 21 | 22 | 23 |
24 |
25 | 26 | 27 | 30 |
31 |
32 | 33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | @await Html.PartialAsync("_WantedPeopleListingsPartial", Model) 41 |
42 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/WantedPeople/Search.cshtml: -------------------------------------------------------------------------------- 1 | @model WantedPeoplePageListingModel 2 | 3 | @{ 4 | ViewData["Title"] = "Search results"; 5 | } 6 | 7 |

@ViewData["Title"]

8 | 9 | @if (Model.WantedPeople.Any()) 10 | { 11 |

Found @Model.SearchCriteriaTotalPages matched results.

12 | 13 |
14 | @await Html.PartialAsync("_WantedPeopleListingsPartial", Model) 15 |
16 | } 17 | else 18 | { 19 |

No people to show.

20 | } 21 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/WantedPeople/_WantedPeopleListingsPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model WantedPeoplePageListingModel 2 | 3 | @{ 4 | var previousDisabled = Model.CurrentPage == 1 ? "disabled" : string.Empty; 5 | var nextDisabled = Model.CurrentPage == Model.TotalPages ? "disabled" : string.Empty; 6 | } 7 | 8 |
9 |
10 | @foreach (var person in Model.WantedPeople) 11 | { 12 |
13 |
14 |
15 | Details 16 |
17 |
18 | @if (!person.IsCaught) 19 | { 20 | 21 | } 22 | else 23 | { 24 | 25 | } 26 |
27 |

28 | @($"Name: {person.FirstName} {person.LastName}") 29 |

30 |

31 | @($"Age today: {DateTime.UtcNow.Year - person.DateOfBirth.Year} years old") 32 |

33 |

34 | @($"Nationality: {person.GivenNationalities}") 35 |

36 |
37 |
38 |
39 | } 40 |
41 |
42 | 43 |

Last News:

44 |
45 |
46 | @await Html.PartialAsync("~/Areas/Blog/Views/Articles/_AllArticlesPartial.cshtml", Model.Articles) 47 |
48 |
49 |
50 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNetCore.Identity 2 | @using InterpolSystem.Data.Models 3 | @using InterpolSystem.Data.Models.Enums 4 | @using InterpolSystem.Services.Models.MissingPeople 5 | @using InterpolSystem.Services.Models.WantedPeople 6 | @using InterpolSystem.Web 7 | @using InterpolSystem.Web.Infrastructure.Extensions 8 | @using InterpolSystem.Web.Models 9 | @using InterpolSystem.Web.Models.MissingPeople 10 | @using InterpolSystem.Web.Models.WantedPeople 11 | @using InterpolSystem.Web.Models.Account 12 | @using InterpolSystem.Web.Models.Manage 13 | @using InterpolSystem.Web.Models.Shared 14 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers 15 | -------------------------------------------------------------------------------- /InterpolSystem.Web/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "_Layout"; 3 | } 4 | -------------------------------------------------------------------------------- /InterpolSystem.Web/WebConstants.cs: -------------------------------------------------------------------------------- 1 | namespace InterpolSystem.Web 2 | { 3 | public class WebConstants 4 | { 5 | public const string AdministratorRole = "Administrator"; 6 | public const string WantedMissingPeopleRole = "BountyAdministrator"; 7 | public const string BountyHunterRole = "BountyHunter"; 8 | public const string BloggerRole = "Blogger"; 9 | public const string TestRole = "Test"; 10 | // public const string PoliceOfficerRole = "PoliceOfficer"; 11 | 12 | public const string AdminArea = "Admin"; 13 | public const string BountyAdminArea = "BountyAdmin"; 14 | public const string BlogArea = "Blog"; 15 | public const string BountyHunterArea = "BountyHunter"; 16 | 17 | public const string TempDataErrorMessageKey = "ErrorMessage"; 18 | public const string TempDataSuccessMessageKey = "SuccessMessage"; 19 | 20 | public const string MissingPeopleControllerName = "MissingPeople"; 21 | public const string WantedPeopleControllerName = "WantedPeople"; 22 | 23 | public const string ValidForm = "ValidSubmitForm"; 24 | 25 | public const int PageSize = 6; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /InterpolSystem.Web/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Debug", 6 | "System": "Information", 7 | "Microsoft": "Information" 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /InterpolSystem.Web/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "IncludeScopes": false, 4 | "LogLevel": { 5 | "Default": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /InterpolSystem.Web/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "asp.net", 3 | "private": true, 4 | "dependencies": { 5 | } 6 | } -------------------------------------------------------------------------------- /InterpolSystem.Web/bundleconfig.json: -------------------------------------------------------------------------------- 1 | // Configure bundling and minification for the project. 2 | // More info at https://go.microsoft.com/fwlink/?LinkId=808241 3 | [ 4 | { 5 | "outputFileName": "wwwroot/css/site.min.css", 6 | // An array of relative input file paths. Globbing patterns supported 7 | "inputFiles": [ 8 | "wwwroot/css/site.css" 9 | ] 10 | }, 11 | { 12 | "outputFileName": "wwwroot/js/site.min.js", 13 | "inputFiles": [ 14 | "wwwroot/js/site.js" 15 | ], 16 | // Optionally specify minification options 17 | "minify": { 18 | "enabled": true, 19 | "renameLocals": true 20 | }, 21 | // Optionally generate .map file 22 | "sourceMap": false 23 | } 24 | ] 25 | -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/css/site.min.css: -------------------------------------------------------------------------------- 1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}} -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/favicon.ico -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/images/background-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/background-logo.jpg -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/images/caught-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/caught-logo.jpg -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/images/cyber-crime.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/cyber-crime.jpg -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/images/interpol-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/interpol-logo.png -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/images/shoot-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/shoot-logo.jpg -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/images/skyscraper-attack.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/images/skyscraper-attack.jpg -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/js/site.js: -------------------------------------------------------------------------------- 1 | // Write your JavaScript code. 2 | let result; 3 | $(document).ready(function () { 4 | let element = $('

'); 5 | 6 | $("input, textarea").on('focus', function () { 7 | element.insertBefore($(this)); 8 | }); 9 | $("input, textarea").on('blur', function () { 10 | element.remove(); 11 | }); 12 | 13 | //animation for navbar 14 | $('.navbar .dropdown').hover(function () { 15 | $(this).find('.dropdown-menu').first().stop(true, true).slideToggle(400); 16 | }, function () { 17 | $(this).find('.dropdown-menu').first().stop(true, true).slideToggle(400) 18 | }); 19 | 20 | //notification about submit forms 21 | result = $('.result').text(); 22 | $('.result').css('display', 'none'); 23 | if (result !=="") { 24 | let li = $("#SubmitFormWantedA"); 25 | let span = $(` ${result} `) 26 | .css({ 27 | 'background-color': 'red', 28 | 'border-radius': '50%', 29 | 'text-align': 'right', 30 | 'margin-left': '2px', 31 | 'margin-right': '2px' 32 | }) 33 | .appendTo(li); 34 | 35 | let ul = $("#managePeopleA"); 36 | let span2 = $(` ${result} `) 37 | .css({ 38 | 'background-color': 'red', 39 | 'border-radius': '50%', 40 | 'text-align': 'right', 41 | 'margin-left': '2px', 42 | 'margin-right': '2px' 43 | }) 44 | .prependTo(ul); 45 | } 46 | 47 | // right nav bar - articles 48 | let aElement = $('.list-group-item>a'); 49 | aElement.css('text-decoration', 'none'); 50 | 51 | aElement.on('mouseover', function () { 52 | $(this).fadeOut(300); 53 | $(this).fadeIn(600); 54 | $(this).addClass('text-danger'); 55 | $(this).removeClass('glyphicon glyphicon-hand-right'); 56 | $(this).css('font-size', '170%'); 57 | }); 58 | 59 | aElement.on('mouseout', function () { 60 | $(this).addClass('glyphicon glyphicon-hand-right'); 61 | $(this).removeClass('text-danger'); 62 | $(this).css('font-size', '100%'); 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/js/site.min.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/js/site.min.js -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/bootstrap/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bootstrap", 3 | "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", 4 | "keywords": [ 5 | "css", 6 | "js", 7 | "less", 8 | "mobile-first", 9 | "responsive", 10 | "front-end", 11 | "framework", 12 | "web" 13 | ], 14 | "homepage": "http://getbootstrap.com", 15 | "license": "MIT", 16 | "moduleType": "globals", 17 | "main": [ 18 | "less/bootstrap.less", 19 | "dist/js/bootstrap.js" 20 | ], 21 | "ignore": [ 22 | "/.*", 23 | "_config.yml", 24 | "CNAME", 25 | "composer.json", 26 | "CONTRIBUTING.md", 27 | "docs", 28 | "js/tests", 29 | "test-infra" 30 | ], 31 | "dependencies": { 32 | "jquery": "1.9.1 - 3" 33 | }, 34 | "version": "3.3.7", 35 | "_release": "3.3.7", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "v3.3.7", 39 | "commit": "0b9c4a4007c44201dce9a6cc1a38407005c26c86" 40 | }, 41 | "_source": "https://github.com/twbs/bootstrap.git", 42 | "_target": "v3.3.7", 43 | "_originalSource": "bootstrap", 44 | "_direct": true 45 | } -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/bootstrap/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2011-2016 Twitter, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stefanMinch3v/InterpolSystem/527a42ea84975f1d1166e17b438011307f674162/InterpolSystem.Web/wwwroot/lib/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/bootstrap/dist/js/npm.js: -------------------------------------------------------------------------------- 1 | // This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment. 2 | require('../../js/transition.js') 3 | require('../../js/alert.js') 4 | require('../../js/button.js') 5 | require('../../js/carousel.js') 6 | require('../../js/collapse.js') 7 | require('../../js/dropdown.js') 8 | require('../../js/modal.js') 9 | require('../../js/tooltip.js') 10 | require('../../js/popover.js') 11 | require('../../js/scrollspy.js') 12 | require('../../js/tab.js') 13 | require('../../js/affix.js') -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/jquery-validation-unobtrusive/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-validation-unobtrusive", 3 | "version": "3.2.6", 4 | "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive", 5 | "description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.", 6 | "main": [ 7 | "jquery.validate.unobtrusive.js" 8 | ], 9 | "ignore": [ 10 | "**/.*", 11 | "*.json", 12 | "*.md", 13 | "*.txt", 14 | "gulpfile.js" 15 | ], 16 | "keywords": [ 17 | "jquery", 18 | "asp.net", 19 | "mvc", 20 | "validation", 21 | "unobtrusive" 22 | ], 23 | "authors": [ 24 | "Microsoft" 25 | ], 26 | "license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm", 27 | "repository": { 28 | "type": "git", 29 | "url": "git://github.com/aspnet/jquery-validation-unobtrusive.git" 30 | }, 31 | "dependencies": { 32 | "jquery-validation": ">=1.8", 33 | "jquery": ">=1.8" 34 | }, 35 | "_release": "3.2.6", 36 | "_resolution": { 37 | "type": "version", 38 | "tag": "v3.2.6", 39 | "commit": "13386cd1b5947d8a5d23a12b531ce3960be1eba7" 40 | }, 41 | "_source": "git://github.com/aspnet/jquery-validation-unobtrusive.git", 42 | "_target": "3.2.6", 43 | "_originalSource": "jquery-validation-unobtrusive" 44 | } -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/jquery-validation/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery-validation", 3 | "homepage": "http://jqueryvalidation.org/", 4 | "repository": { 5 | "type": "git", 6 | "url": "git://github.com/jzaefferer/jquery-validation.git" 7 | }, 8 | "authors": [ 9 | "Jörn Zaefferer " 10 | ], 11 | "description": "Form validation made easy", 12 | "main": "dist/jquery.validate.js", 13 | "keywords": [ 14 | "forms", 15 | "validation", 16 | "validate" 17 | ], 18 | "license": "MIT", 19 | "ignore": [ 20 | "**/.*", 21 | "node_modules", 22 | "bower_components", 23 | "test", 24 | "demo", 25 | "lib" 26 | ], 27 | "dependencies": { 28 | "jquery": ">= 1.7.2" 29 | }, 30 | "version": "1.14.0", 31 | "_release": "1.14.0", 32 | "_resolution": { 33 | "type": "version", 34 | "tag": "1.14.0", 35 | "commit": "c1343fb9823392aa9acbe1c3ffd337b8c92fed48" 36 | }, 37 | "_source": "git://github.com/jzaefferer/jquery-validation.git", 38 | "_target": ">=1.8", 39 | "_originalSource": "jquery-validation" 40 | } -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/jquery-validation/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright Jörn Zaefferer 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/jquery/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jquery", 3 | "main": "dist/jquery.js", 4 | "license": "MIT", 5 | "ignore": [ 6 | "package.json" 7 | ], 8 | "keywords": [ 9 | "jquery", 10 | "javascript", 11 | "browser", 12 | "library" 13 | ], 14 | "homepage": "https://github.com/jquery/jquery-dist", 15 | "version": "2.2.0", 16 | "_release": "2.2.0", 17 | "_resolution": { 18 | "type": "version", 19 | "tag": "2.2.0", 20 | "commit": "6fc01e29bdad0964f62ef56d01297039cdcadbe5" 21 | }, 22 | "_source": "git://github.com/jquery/jquery-dist.git", 23 | "_target": "2.2.0", 24 | "_originalSource": "jquery" 25 | } -------------------------------------------------------------------------------- /InterpolSystem.Web/wwwroot/lib/jquery/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright jQuery Foundation and other contributors, https://jquery.org/ 2 | 3 | This software consists of voluntary contributions made by many 4 | individuals. For exact contribution history, see the revision history 5 | available at https://github.com/jquery/jquery 6 | 7 | The following license applies to all parts of this software except as 8 | documented below: 9 | 10 | ==== 11 | 12 | Permission is hereby granted, free of charge, to any person obtaining 13 | a copy of this software and associated documentation files (the 14 | "Software"), to deal in the Software without restriction, including 15 | without limitation the rights to use, copy, modify, merge, publish, 16 | distribute, sublicense, and/or sell copies of the Software, and to 17 | permit persons to whom the Software is furnished to do so, subject to 18 | the following conditions: 19 | 20 | The above copyright notice and this permission notice shall be 21 | included in all copies or substantial portions of the Software. 22 | 23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 30 | 31 | ==== 32 | 33 | All files located in the node_modules and external directories are 34 | externally maintained libraries used by this software which have their 35 | own licenses; we recommend you read them, as their terms may differ from 36 | the terms above. 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Stefan Minchev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # InterpolSystem 2 | Fourth semester project based on ASP.NET Core 2.0, EF Core, MSSQL, JQuery and Bootstrap 3 | 4 | AppVeyor - Tests status: 5 | [![Build status](https://ci.appveyor.com/api/projects/status/1ao864nuqxa0kjmx?svg=true)](https://ci.appveyor.com/project/stefanMinch3v/interpolsystem) 6 | 7 | #Random pics: 8 | ![Home](https://i.imgur.com/ZZNLwVn.png) 9 | ![RandomPic1](https://i.imgur.com/ex6m2Zy.png) 10 | ![RandomPic2](https://i.imgur.com/kBiNGCz.png) 11 | ![RandomPic3](https://i.imgur.com/ZOozPOQ.png) 12 | ![RandomPic4](https://i.imgur.com/kJOqRO1.png) 13 | ![RandomPic5](https://i.imgur.com/1aU4Yoa.png) 14 | ![RandomPic6](https://i.imgur.com/2WbH3ck.png) 15 | ![RandomPic7](https://i.imgur.com/fHAgKHs.png) 16 | ![RandomPic8](https://i.imgur.com/Xv1TmlL.png) 17 | ![RandomPic9](https://i.imgur.com/tIH2vO4.png) 18 | ![RandomPic10](https://i.imgur.com/CuETkxP.png) --------------------------------------------------------------------------------