├── OnlineVotingSystem ├── Interfaces │ ├── IUserService.cs │ ├── ICandidateService.cs │ ├── IAccountService.cs │ └── IVotingService.cs ├── Entities │ ├── Voter.cs │ ├── Candidate.cs │ ├── Account.cs │ └── Commons │ │ └── Auditable.cs ├── Program.cs ├── Data │ ├── candidates.json │ └── accounts.json ├── OnlineVotingSystem.csproj ├── Configurations │ └── Constants.cs ├── Helpers │ └── FileIO.cs ├── Servises │ ├── AccountService.cs │ ├── UserService.cs │ ├── CandidateService.cs │ └── VotingService.cs └── Uis │ ├── VotingUI.cs │ ├── UserUi.cs │ ├── AccountUi.cs │ └── MainUi.cs ├── README.md ├── LICENSE.txt ├── OnlineVotingSystem.sln ├── .gitattributes └── .gitignore /OnlineVotingSystem/Interfaces/IUserService.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Entities; 2 | 3 | namespace OnlineVotingSystem.Interfaces; 4 | 5 | public interface IUserService 6 | { 7 | Task Send(string gmail, string name); 8 | Account GetAccount(string gmail); 9 | } 10 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Entities/Voter.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Entities.Commons; 2 | 3 | namespace OnlineVotingSystem; 4 | 5 | public class Voter : Auditable 6 | { 7 | public int Id { get; set; } 8 | public string Name { get; set; } 9 | public bool HasVoted { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Entities/Candidate.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Entities.Commons; 2 | 3 | namespace OnlineVotingSystem.Entities; 4 | 5 | public class Candidate : Auditable 6 | { 7 | public int Id { get; set; } 8 | public string Name { get; set; } 9 | public int Votes { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Entities/Account.cs: -------------------------------------------------------------------------------- 1 | namespace OnlineVotingSystem.Entities; 2 | 3 | public class Account : Voter 4 | { 5 | private static int id = 1; 6 | public int Id = ++id; 7 | public string Name { get; set; } 8 | public string Email { get; set; } 9 | public string Password { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Entities/Commons/Auditable.cs: -------------------------------------------------------------------------------- 1 | namespace OnlineVotingSystem.Entities.Commons; 2 | 3 | public abstract class Auditable 4 | { 5 | public long Id { get; set; } 6 | public DateTime CreatedAt { get; set; } = DateTime.UtcNow; 7 | public DateTime UpdatedAt { get; set; } 8 | public DateTime DeletedAt { get; set; } 9 | public bool IsDeleted { get; set; } 10 | } 11 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Interfaces/ICandidateService.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Entities; 2 | 3 | namespace OnlineVotingSystem.Interfaces; 4 | 5 | 6 | public interface ICandidateService 7 | { 8 | void AddCandidate(string name); 9 | List GetCandidates(); 10 | Candidate GetCandidateById(int candidateId); 11 | void UpdateCandidateVotes(int candidateId, int votes); 12 | } 13 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Interfaces/IAccountService.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Entities; 2 | 3 | namespace OnlineVotingSystem.Interfaces; 4 | 5 | public interface IAccountService 6 | { 7 | void Create(Account account); 8 | void ChangeName(Account account, string name); 9 | void ChangePassword(Account account, string password); 10 | void ChangeEmail(Account account, string email); 11 | Account GetAccountByGmail(string gmail); 12 | } 13 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Program.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Servises; 2 | using OnlineVotingSystem.Uis; 3 | using Spectre.Console; 4 | 5 | namespace OnlineVotingSystem; 6 | 7 | public class Program 8 | { 9 | private static async Task Main(string[] args) 10 | { 11 | MainUi mainUi = new MainUi(); 12 | await mainUi.Run(); 13 | 14 | AnsiConsole.WriteLine("-----"); 15 | AnsiConsole.MarkupLine("| c | [bold]Asrorbek Abrorov[/]. [italic]All rights reserved.[/]"); 16 | AnsiConsole.WriteLine("-----"); 17 | } 18 | } -------------------------------------------------------------------------------- /OnlineVotingSystem/Data/candidates.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Id": 1, 4 | "Name": "Who are You?", 5 | "Votes": 2, 6 | "CreatedAt": "2024-02-24T08:56:07.3186249Z", 7 | "UpdatedAt": "0001-01-01T00:00:00", 8 | "DeletedAt": "0001-01-01T00:00:00", 9 | "IsDeleted": false 10 | }, 11 | { 12 | "Id": 2, 13 | "Name": "Who am I?", 14 | "Votes": 0, 15 | "CreatedAt": "2024-02-24T08:56:07.3186582Z", 16 | "UpdatedAt": "0001-01-01T00:00:00", 17 | "DeletedAt": "0001-01-01T00:00:00", 18 | "IsDeleted": false 19 | } 20 | ] -------------------------------------------------------------------------------- /OnlineVotingSystem/Interfaces/IVotingService.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Entities; 2 | 3 | namespace OnlineVotingSystem.Interfaces; 4 | 5 | public interface IVotingService 6 | { 7 | void AddCandidate(string name); 8 | void AddVoter(string name); 9 | bool Vote(int voterId, int candidateId); 10 | List GetCandidates(); 11 | List GetVoters(); 12 | void SaveCandidatesToFile(); 13 | void SaveVotersToFile(); 14 | void LoadCandidatesFromFile(); 15 | void LoadVotersFromFile(); 16 | void InitializeFromFiles(); 17 | } -------------------------------------------------------------------------------- /OnlineVotingSystem/OnlineVotingSystem.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Configurations/Constants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace OnlineVotingSystem.Configurations; 8 | 9 | public class Constants 10 | { 11 | public const string CandidatesPath = "../../../../OnlineVotingSystem/Data/candidates.json"; 12 | public const string UsersPath = "../../../../OnlineVotingSystem/Data/accounts.json"; 13 | public const string ApiKey = "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"; 14 | public const string Account = "as.abrorov@gmail.com"; 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OnlineVotingSystem 2 | ![image](https://github.com/Asrorbek-Abrorov/OnlineVotingSystem/assets/138248626/08694a8d-d940-4c89-80d7-0ea09e107258) 3 | 4 | ![image](https://github.com/Asrorbek-Abrorov/OnlineVotingSystem/assets/138248626/d6135839-fd09-4676-a3b5-598fd3e79bdc) 5 | 6 | ![image](https://github.com/Asrorbek-Abrorov/OnlineVotingSystem/assets/138248626/f41090dc-57a3-48ea-8576-8132a035654d) 7 | 8 | ![image](https://github.com/Asrorbek-Abrorov/OnlineVotingSystem/assets/138248626/58387e1a-2728-4077-9a72-d195c58805e1) 9 | 10 | ![image](https://github.com/Asrorbek-Abrorov/OnlineVotingSystem/assets/138248626/5bc1f4f2-4980-46c5-a47b-e243cb31fba3) 11 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Helpers/FileIO.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace OnlineVotingSystem.Helpers; 9 | 10 | public static class FileIO 11 | { 12 | public static async Task> ReadAsync(string path) 13 | { 14 | var content = await File.ReadAllTextAsync(path); 15 | if (string.IsNullOrEmpty(content)) 16 | return new List(); 17 | 18 | return JsonConvert.DeserializeObject>(content); 19 | } 20 | 21 | public static async Task WriteAsync(string path, List values) 22 | { 23 | var json = JsonConvert.SerializeObject(values, Formatting.Indented); 24 | await File.WriteAllTextAsync(path, json); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Data/accounts.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Id": 1, 4 | "Name": "Asrorbek", 5 | "Email": "asrorbekabrorov5@gmail.com", 6 | "Password": "admin", 7 | "HasVoted": false, 8 | "CreatedAt": "2024-02-24T13:00:56.2894205Z", 9 | "UpdatedAt": "0001-01-01T00:00:00", 10 | "DeletedAt": "0001-01-01T00:00:00", 11 | "IsDeleted": false 12 | }, 13 | { 14 | "Id": 2, 15 | "Name": "Asror", 16 | "Email": "as.abrorov2@gmail.com", 17 | "Password": "1234", 18 | "HasVoted": true, 19 | "CreatedAt": "2024-02-24T13:01:15.3010124Z", 20 | "UpdatedAt": "0001-01-01T00:00:00", 21 | "DeletedAt": "0001-01-01T00:00:00", 22 | "IsDeleted": false 23 | }, 24 | { 25 | "Id": 8, 26 | "Name": "aaaaaaaaaa", 27 | "Email": "oripovjasurbek@gmail.com", 28 | "Password": "1234", 29 | "HasVoted": true, 30 | "CreatedAt": "2024-02-24T17:38:36.5956042Z", 31 | "UpdatedAt": "0001-01-01T00:00:00", 32 | "DeletedAt": "0001-01-01T00:00:00", 33 | "IsDeleted": false 34 | } 35 | ] -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2024] [Asrorvek Abrorov] 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 | -------------------------------------------------------------------------------- /OnlineVotingSystem.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.8.34601.278 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnlineVotingSystem", "OnlineVotingSystem\OnlineVotingSystem.csproj", "{C2B0CE72-7695-4F93-8FB1-57352DDB7CF3}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {C2B0CE72-7695-4F93-8FB1-57352DDB7CF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {C2B0CE72-7695-4F93-8FB1-57352DDB7CF3}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {C2B0CE72-7695-4F93-8FB1-57352DDB7CF3}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {C2B0CE72-7695-4F93-8FB1-57352DDB7CF3}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {B6786F4D-B91C-453D-91C7-4ECAF8C5F14D} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Servises/AccountService.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using OnlineVotingSystem.Entities; 3 | using OnlineVotingSystem.Interfaces; 4 | 5 | namespace OnlineVotingSystem.Servises; 6 | 7 | public class AccountService : IAccountService 8 | { 9 | private List accounts; 10 | private string accountsFilePath; 11 | 12 | public AccountService(string accountsFilePath) 13 | { 14 | accounts = new List(); 15 | this.accountsFilePath = accountsFilePath; 16 | LoadAccounts(); 17 | } 18 | 19 | public void Create(Account account) 20 | { 21 | accounts.Add(account); 22 | SaveAccounts(); 23 | } 24 | 25 | public void ChangeName(Account account, string name) 26 | { 27 | if (account != null) 28 | { 29 | account.Name = name; 30 | SaveAccounts(); 31 | } 32 | } 33 | 34 | public void ChangePassword(Account account, string password) 35 | { 36 | if (account != null) 37 | { 38 | account.Password = password; 39 | SaveAccounts(); 40 | } 41 | } 42 | 43 | public void ChangeEmail(Account account, string email) 44 | { 45 | if (account != null) 46 | { 47 | account.Email = email; 48 | SaveAccounts(); 49 | } 50 | } 51 | 52 | private void LoadAccounts() 53 | { 54 | if (File.Exists(accountsFilePath)) 55 | { 56 | string json = File.ReadAllText(accountsFilePath); 57 | accounts = JsonConvert.DeserializeObject>(json); 58 | } 59 | } 60 | 61 | private void SaveAccounts() 62 | { 63 | string json = JsonConvert.SerializeObject(accounts, Formatting.Indented); 64 | File.WriteAllText(accountsFilePath, json); 65 | } 66 | 67 | public Account GetAccountByGmail(string gmail) 68 | { 69 | LoadAccounts(); 70 | return accounts.Find(account => account.Email == gmail); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Servises/UserService.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Entities; 2 | using OnlineVotingSystem.Interfaces; 3 | using OnlineVotingSystem.Servises; 4 | using SendGrid; 5 | using SendGrid.Helpers.Mail; 6 | 7 | namespace OnlineVotingSystem; 8 | 9 | public class UserService(AccountService accountService) : IUserService 10 | { 11 | public readonly AccountService accountService = accountService; 12 | 13 | public async Task Send(string gmail, string name) 14 | => await Execute(gmail, name); 15 | 16 | private static async Task Execute(string gmail, string name) 17 | { 18 | var apiKey = Environment.GetEnvironmentVariable(Configurations.Constants.ApiKey); 19 | var client = new SendGridClient(apiKey ?? "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"); 20 | var from = new EmailAddress(Configurations.Constants.Account, "From Asror"); 21 | var subject = "Verification Code"; 22 | var to = new EmailAddress(gmail, name); 23 | var verificationCode = GenerateVerificationCode(); 24 | var plainTextContent = $"Your verification code is: {verificationCode}"; 25 | var htmlContent = $"

Your verification code is: {verificationCode}

"; 26 | var msg = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent); 27 | var response = await client.SendEmailAsync(msg); 28 | return verificationCode; 29 | } 30 | 31 | private static string GenerateVerificationCode() 32 | { 33 | const int codeLength = 6; 34 | const string characters = "0123456789"; 35 | var random = new Random(); 36 | var code = new char[codeLength]; 37 | 38 | for (int i = 0; i < codeLength; i++) 39 | { 40 | code[i] = characters[random.Next(characters.Length)]; 41 | } 42 | 43 | return new string(code); 44 | } 45 | public Account GetAccount(string gmail) 46 | => accountService.GetAccountByGmail(gmail); 47 | 48 | } -------------------------------------------------------------------------------- /OnlineVotingSystem/Servises/CandidateService.cs: -------------------------------------------------------------------------------- 1 | using EllipticCurve.Utils; 2 | using Newtonsoft.Json; 3 | using OnlineVotingSystem.Entities; 4 | using OnlineVotingSystem.Interfaces; 5 | using System.IO; 6 | using File = System.IO.File; 7 | 8 | namespace OnlineVotingSystem.Servises; 9 | 10 | public class CandidateService : ICandidateService 11 | { 12 | private List candidates; 13 | 14 | public CandidateService() 15 | { 16 | candidates = new List(); 17 | LoadCandidatesFromFile(); 18 | } 19 | 20 | public void AddCandidate(string name) 21 | { 22 | int id = candidates.Count + 1; 23 | candidates.Add(new Candidate { Id = id, Name = name, Votes = 0 }); 24 | SaveCandidatesToFile(); 25 | } 26 | 27 | public List GetCandidates() 28 | { 29 | LoadCandidatesFromFile(); 30 | return candidates; 31 | } 32 | 33 | public Candidate GetCandidateById(int candidateId) 34 | { 35 | LoadCandidatesFromFile(); 36 | return candidates.Find(c => c.Id == candidateId); 37 | } 38 | public void UpdateCandidateName(int candidateId, string name) 39 | { 40 | LoadCandidatesFromFile(); 41 | Candidate candidate = GetCandidateById(candidateId); 42 | if (candidate != null) 43 | { 44 | candidate.Name = name; 45 | } 46 | SaveCandidatesToFile(); 47 | } 48 | 49 | public void UpdateCandidateVotes(int candidateId, int votes) 50 | { 51 | LoadCandidatesFromFile(); 52 | Candidate candidate = GetCandidateById(candidateId); 53 | if (candidate != null) 54 | { 55 | candidate.Votes = votes; 56 | } 57 | SaveCandidatesToFile(); 58 | } 59 | public void SaveCandidatesToFile() 60 | { 61 | var candidatesJson = JsonConvert.SerializeObject(candidates, Formatting.Indented); 62 | File.WriteAllText(Configurations.Constants.CandidatesPath, candidatesJson); 63 | } 64 | public void LoadCandidatesFromFile() 65 | { 66 | if (File.Exists(Configurations.Constants.CandidatesPath)) 67 | { 68 | var candidatesJson = File.ReadAllText(Configurations.Constants.CandidatesPath); 69 | candidates = JsonConvert.DeserializeObject>(candidatesJson); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Uis/VotingUI.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Entities; 2 | using OnlineVotingSystem.UI; 3 | using Spectre.Console; 4 | 5 | namespace OnlineVotingSystem.Uis; 6 | 7 | public class VotingUI(VotingService votingService, AccountUI accountUI) 8 | { 9 | public async Task Run(Account account) 10 | { 11 | votingService.InitializeFromFiles(); 12 | 13 | while (true) 14 | { 15 | AnsiConsole.Clear(); 16 | AnsiConsole.Write( 17 | new FigletText("*** Voting *** System") 18 | .Centered() 19 | .Color(Color.Blue3_1)); 20 | var option = AnsiConsole.Prompt( 21 | new SelectionPrompt() 22 | .AddChoices( 23 | ["[bold green]Vote[/]", "[bold green]View Results[/]", "[bold green]Account Settings[/]", "[bold red]Exit[/]"] 24 | ) 25 | ); 26 | 27 | switch (option) 28 | { 29 | case "[bold green]Vote[/]": 30 | Vote(account); 31 | break; 32 | case "[bold green]View Results[/]": 33 | ViewResults(); 34 | break; 35 | case "[bold green]Account Settings[/]": 36 | await accountUI.Run(account); 37 | break; 38 | case "[bold red]Exit[/]": 39 | votingService.SaveCandidatesToFile(); 40 | votingService.SaveVotersToFile(); 41 | return; 42 | default: 43 | AnsiConsole.MarkupLine("[bold red]Invalid choice.[/]"); 44 | break; 45 | } 46 | 47 | AnsiConsole.WriteLine(); 48 | AnsiConsole.MarkupLine("[bold cyan]Press any key to continue...[/]"); 49 | Console.ReadKey(); 50 | } 51 | } 52 | 53 | private string GetUserInput(string message) 54 | { 55 | AnsiConsole.Markup(message); 56 | return Console.ReadLine(); 57 | } 58 | private void Vote(Account account) 59 | { 60 | List candidates = votingService.GetCandidates(); 61 | var candidate = AnsiConsole.Prompt( 62 | new SelectionPrompt() 63 | .Title("[bold cyan]Available candidates:[/]") 64 | .PageSize(10) 65 | .AddChoices(candidates) 66 | .UseConverter(c => c.Name) 67 | ); 68 | 69 | bool voteResult = votingService.Vote(account.Id, candidate.Id); 70 | if (voteResult) 71 | { 72 | AnsiConsole.MarkupLine("[bold green]Vote recorded successfully.[/]"); 73 | } 74 | else 75 | { 76 | AnsiConsole.MarkupLine("[bold red]Voter has already voted.[/]"); 77 | } 78 | } 79 | 80 | private void ViewResults() 81 | { 82 | AnsiConsole.MarkupLine("[bold cyan]===== Voting Results =====[/]"); 83 | List results = votingService.GetCandidates(); 84 | foreach (var candidate in results) 85 | { 86 | AnsiConsole.MarkupLine($"[bold white]{candidate.Name}[/]: [bold yellow]{candidate.Votes} votes[/]"); 87 | } 88 | } 89 | } -------------------------------------------------------------------------------- /OnlineVotingSystem/Servises/VotingService.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualBasic; 2 | using Newtonsoft.Json; 3 | using OnlineVotingSystem.Entities; 4 | using OnlineVotingSystem.Interfaces; 5 | using OnlineVotingSystem.Configurations; 6 | namespace OnlineVotingSystem; 7 | 8 | public class VotingService : IVotingService 9 | { 10 | private List candidates; 11 | private List accounts; 12 | 13 | public VotingService() 14 | { 15 | candidates = new List(); 16 | accounts = new List(); 17 | } 18 | 19 | public void AddCandidate(string name) 20 | { 21 | int id = candidates.Count + 1; 22 | candidates.Add(new Candidate { Id = id, Name = name, Votes = 0 }); 23 | SaveCandidatesToFile(); 24 | } 25 | 26 | public void AddVoter(string name) 27 | { 28 | int id = accounts.Count + 1; 29 | accounts.Add(new Account { Id = id, Name = name, HasVoted = false }); 30 | SaveVotersToFile(); 31 | } 32 | 33 | public bool Vote(int voterId, int candidateId) 34 | { 35 | var voter = accounts.Find(x => x.Id == voterId); 36 | Candidate candidate = candidates.Find(c => c.Id == candidateId); 37 | 38 | if (voter == null || candidate == null) 39 | { 40 | return false; 41 | } 42 | 43 | if (voter.HasVoted) 44 | { 45 | return false; 46 | } 47 | 48 | candidate.Votes++; 49 | voter.HasVoted = true; 50 | SaveCandidatesToFile(); 51 | SaveVotersToFile(); 52 | 53 | return true; 54 | } 55 | 56 | public List GetCandidates() 57 | { 58 | LoadCandidatesFromFile(); 59 | return candidates; 60 | } 61 | 62 | public List GetVoters() 63 | { 64 | LoadVotersFromFile(); 65 | return accounts; 66 | } 67 | 68 | public void SaveCandidatesToFile() 69 | { 70 | var candidatesJson = JsonConvert.SerializeObject(candidates, Formatting.Indented); 71 | File.WriteAllText(Configurations.Constants.CandidatesPath, candidatesJson); 72 | } 73 | 74 | public void SaveVotersToFile() 75 | { 76 | var votersJson = JsonConvert.SerializeObject(accounts, Formatting.Indented); 77 | File.WriteAllText(Configurations.Constants.UsersPath, votersJson); 78 | } 79 | 80 | public void LoadCandidatesFromFile() 81 | { 82 | if (File.Exists(Configurations.Constants.CandidatesPath)) 83 | { 84 | var candidatesJson = File.ReadAllText(Configurations.Constants.CandidatesPath); 85 | candidates = JsonConvert.DeserializeObject>(candidatesJson); 86 | } 87 | } 88 | 89 | public void LoadVotersFromFile() 90 | { 91 | if (File.Exists(Configurations.Constants.UsersPath)) 92 | { 93 | var votersJson = File.ReadAllText(Configurations.Constants.UsersPath); 94 | accounts = JsonConvert.DeserializeObject>(votersJson); 95 | } 96 | } 97 | 98 | public void InitializeFromFiles() 99 | { 100 | LoadCandidatesFromFile(); 101 | LoadVotersFromFile(); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Uis/UserUi.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Entities; 2 | using OnlineVotingSystem.Servises; 3 | using Spectre.Console; 4 | 5 | namespace OnlineVotingSystem.Uis; 6 | 7 | public class UserUi(AccountService accountService) 8 | { 9 | private readonly UserService userService = new UserService(accountService); 10 | public async Task Register() 11 | { 12 | while (true) 13 | { 14 | AnsiConsole.Clear(); 15 | AnsiConsole.Write( 16 | new FigletText("Smart Account System") 17 | .Centered() 18 | .Color(Color.BlueViolet)); 19 | var name = AnsiConsole.Ask("[bold cyan]Enter your name:[/]"); 20 | 21 | var gmail = AnsiConsole.Ask("[bold cyan]Enter your Gmail address:[/]"); 22 | 23 | var foundGmail = accountService.GetAccountByGmail(gmail); 24 | 25 | if (foundGmail != null) 26 | { 27 | return await LogIn(gmail); 28 | } 29 | else 30 | { 31 | var password = AnsiConsole.Prompt(new TextPrompt("[bold cyan]Enter your password:[/]") 32 | .Secret()); 33 | 34 | var password2 = AnsiConsole.Prompt(new TextPrompt("[bold cyan]Repeat your password:[/]") 35 | .Secret()); 36 | 37 | if (password == password2) 38 | { 39 | AnsiConsole.WriteLine(); 40 | AnsiConsole.MarkupLine("[bold cyan]Sending verification code...[/]"); 41 | 42 | try 43 | { 44 | var code = await userService.Send(gmail, name); 45 | 46 | AnsiConsole.WriteLine(); 47 | AnsiConsole.MarkupLine("[bold green]Verification code sent successfully.[/]"); 48 | var verificationCode = AnsiConsole.Ask("[bold cyan]Enter the verification code:[/]"); 49 | if (code == verificationCode) 50 | { 51 | Account account = new Account(); 52 | account.Name = name; 53 | account.Password = password; 54 | account.Email = gmail; 55 | 56 | accountService.Create(account); 57 | 58 | AnsiConsole.MarkupLine("[bold green]Account created successfully.[/]"); 59 | return account; 60 | } 61 | else 62 | { 63 | AnsiConsole.MarkupLine("[bold red]Failed to verify the code![/]"); 64 | } 65 | break; 66 | } 67 | catch (Exception ex) 68 | { 69 | AnsiConsole.WriteLine(); 70 | AnsiConsole.MarkupLine("[bold red]Failed to send verification code.[/]"); 71 | AnsiConsole.WriteLine($"Error: {ex.Message}"); 72 | } 73 | AnsiConsole.Clear(); 74 | } 75 | else 76 | { 77 | AnsiConsole.MarkupLine("[bold red]Passwords didn't match![/]"); 78 | } 79 | } 80 | } 81 | 82 | return null; 83 | } 84 | public async Task LogIn(string gmail) 85 | { 86 | var account = accountService.GetAccountByGmail(gmail); 87 | if (account is not null) 88 | { 89 | var password = AnsiConsole.Prompt(new TextPrompt("[bold cyan]Enter your password:[/]") 90 | .Secret()); 91 | if (password == account.Password) 92 | { 93 | return account; 94 | } 95 | else 96 | { 97 | AnsiConsole.MarkupLine("[red]Wrong password[/]"); 98 | return null; 99 | } 100 | } 101 | else 102 | { 103 | AnsiConsole.MarkupLine("Couldn't find account with this ", gmail); 104 | return null; 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /OnlineVotingSystem/Uis/AccountUi.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Entities; 2 | using OnlineVotingSystem.Servises; 3 | using Spectre.Console; 4 | 5 | namespace OnlineVotingSystem.UI; 6 | 7 | public class AccountUI(AccountService accountService, UserService userService) 8 | { 9 | public async Task Run(Account account) 10 | { 11 | while (true) 12 | { 13 | Console.Clear(); 14 | AnsiConsole.Write( 15 | new FigletText("Account Management") 16 | .Centered() 17 | .Color(Color.Green3_1)); 18 | var option = AnsiConsole.Prompt( 19 | new SelectionPrompt() 20 | .AddChoices( 21 | new[] 22 | { 23 | "[bold cyan]View Details[/]", 24 | "[bold cyan]Change Name[/]", 25 | "[bold cyan]Change Password[/]", 26 | "[bold cyan]Change Email[/]", 27 | "[bold red]Exit[/]" 28 | })); 29 | 30 | switch (option) 31 | { 32 | case "[bold cyan]View Details[/]": 33 | var password = AnsiConsole.Prompt(new TextPrompt("[yellow]Enter Password:[/]") 34 | .Secret() 35 | .PromptStyle("red")); 36 | if (password == account.Password) 37 | { 38 | ViewDetails(account); 39 | } 40 | else 41 | { 42 | AnsiConsole.MarkupLine("[red]Wrong password[/]"); 43 | } 44 | break; 45 | 46 | case "[bold cyan]Change Name[/]": 47 | password = AnsiConsole.Prompt(new TextPrompt("[yellow]Enter Password:[/]") 48 | .Secret() 49 | .PromptStyle("red")); 50 | 51 | if (password == account.Password) 52 | { 53 | ChangeName(account); 54 | } 55 | else 56 | { 57 | AnsiConsole.MarkupLine("[red]Wrong password[/]"); 58 | } 59 | 60 | break; 61 | 62 | case "[bold cyan]Change Password[/]": 63 | password = AnsiConsole.Prompt(new TextPrompt("[yellow]Enter Password:[/]") 64 | .Secret() 65 | .PromptStyle("red")); 66 | 67 | if (password == account.Password) 68 | { 69 | ChangePassword(account); 70 | } 71 | else 72 | { 73 | AnsiConsole.MarkupLine("[red]Wrong password[/]"); 74 | } 75 | break; 76 | 77 | case "[bold cyan]Change Email[/]": 78 | password = AnsiConsole.Prompt(new TextPrompt("[yellow]Enter Password:[/]") 79 | .Secret() 80 | .PromptStyle("red")); 81 | if (password == account.Password) 82 | { 83 | ChangeEmail(account).GetAwaiter().GetResult(); 84 | } 85 | 86 | break; 87 | 88 | case "[bold red]Exit[/]": 89 | return; 90 | } 91 | 92 | Console.WriteLine(); 93 | AnsiConsole.MarkupLine("[bold green]Press any key to continue...[/]"); 94 | Console.ReadKey(); 95 | } 96 | } 97 | 98 | private static void ViewDetails(Account account) 99 | { 100 | AnsiConsole.MarkupLine(""); 101 | AnsiConsole.MarkupLine($"[bold green]Name:[/] [cyan]{account.Name}[/]"); 102 | AnsiConsole.MarkupLine(""); 103 | AnsiConsole.MarkupLine($"[bold yellow]Password:[/] [magenta]{account.Password}[/]"); 104 | AnsiConsole.MarkupLine(""); 105 | AnsiConsole.MarkupLine($"[bold blue]Email:[/] [yellow]{account.Email}[/]"); 106 | AnsiConsole.MarkupLine(""); 107 | } 108 | 109 | private void ChangeName(Account account) 110 | { 111 | var name = AnsiConsole.Ask("Enter New Name:", account.Name); 112 | 113 | accountService.ChangeName(account, name); 114 | AnsiConsole.MarkupLine("[bold green]Name changed successfully.[/]"); 115 | } 116 | 117 | private void ChangePassword(Account account) 118 | { 119 | var password = AnsiConsole.Ask("Enter New Password:", account.Password); 120 | 121 | accountService.ChangePassword(account, password); 122 | AnsiConsole.MarkupLine("[bold green]Password changed successfully.[/]"); 123 | } 124 | 125 | private async Task ChangeEmail(Account account) 126 | { 127 | string name = "***"; 128 | var gmail = AnsiConsole.Ask("Enter New Email:", account.Email); 129 | AnsiConsole.WriteLine(); 130 | AnsiConsole.MarkupLine("[bold cyan]Sending verification code...[/]"); 131 | 132 | var code = await userService.Send(gmail, name); 133 | 134 | AnsiConsole.WriteLine(); 135 | AnsiConsole.MarkupLine("[bold green]Verification code sent successfully.[/]"); 136 | var verificationCode = AnsiConsole.Ask("[bold cyan]Enter the verification code:[/]"); 137 | if (code == verificationCode) 138 | { 139 | accountService.ChangeEmail(account, gmail); 140 | AnsiConsole.MarkupLine("[bold green]Email changed successfully.[/]"); 141 | } 142 | else 143 | { 144 | AnsiConsole.MarkupLine("[red]Couldn't authenticate ![/]"); 145 | } 146 | 147 | } 148 | } -------------------------------------------------------------------------------- /OnlineVotingSystem/Uis/MainUi.cs: -------------------------------------------------------------------------------- 1 | using OnlineVotingSystem.Entities; 2 | using OnlineVotingSystem.Servises; 3 | using OnlineVotingSystem.UI; 4 | using Spectre.Console; 5 | 6 | namespace OnlineVotingSystem.Uis; 7 | 8 | public class MainUi 9 | { 10 | public static string accountsPath = "../../../../OnlineVotingSystem/Data/accounts.json"; 11 | private static readonly VotingService votingService = new VotingService(); 12 | private static readonly CandidateService candidateService = new CandidateService(); 13 | private static readonly AccountService accountService = new AccountService(accountsPath); 14 | private static readonly UserService userService = new UserService(accountService); 15 | private static readonly AccountUI accountUI = new AccountUI(accountService, userService); 16 | private readonly VotingUI votinUi = new VotingUI(votingService, accountUI); 17 | public async Task Run() 18 | { 19 | await AnsiConsole.Progress() 20 | .StartAsync(async ctx => 21 | { 22 | // Define tasks 23 | var task1 = ctx.AddTask("[green]Starting application[/]"); 24 | 25 | while (!ctx.IsFinished) 26 | { 27 | // Simulate some work 28 | await Task.Delay(250); 29 | 30 | // Increment 31 | task1.Increment(4.5); 32 | } 33 | }); 34 | while (true) 35 | { 36 | AnsiConsole.Clear(); 37 | 38 | AnsiConsole.Write( 39 | new FigletText("Voting Application") 40 | .Centered() 41 | .Color(Color.Red)); 42 | 43 | var start = AnsiConsole.Prompt( 44 | new SelectionPrompt() 45 | .PageSize(5) 46 | .AddChoices(["[green]Start[/]", "[red]Exit[/]"]) 47 | ); 48 | if (start == "[green]Start[/]") 49 | { 50 | votingService.InitializeFromFiles(); 51 | Console.Clear(); 52 | UserUi userUi = new UserUi(accountService); 53 | var account = await userUi.Register(); 54 | 55 | if (account == null) 56 | { 57 | AnsiConsole.MarkupLine("[bold red]Invalid credentials.[/]"); 58 | AnsiConsole.MarkupLine("[bold white]Press any key to[/] [italic yellow]Repeat Autentification...[/]"); 59 | Console.ReadKey(); 60 | } 61 | else if (account.Password == "admin" && account.Email == "asrorbekabrorov5@gmail.com") 62 | { 63 | while (true) 64 | { 65 | AnsiConsole.Clear(); 66 | AnsiConsole.Write( 67 | new FigletText("Welcome Admin") 68 | .Centered() 69 | .Color(Color.DarkCyan)); 70 | 71 | var option = AnsiConsole.Prompt( 72 | new SelectionPrompt() 73 | .AddChoices( 74 | ["[bold green]Add Candidate[/]", "[bold green]Update Candidate[/]", "[bold yellow]View Results[/]", "[bold yellow]View Voters[/]", "[bold red]Exit[/]"] 75 | )); 76 | 77 | switch (option) 78 | { 79 | case "[bold green]Add Candidate[/]": 80 | string candidateName = AnsiConsole.Ask("[bold white]Enter candidate name:[/]"); 81 | candidateService.AddCandidate(candidateName); 82 | AnsiConsole.MarkupLine("[bold green]Candidate added successfully.[/]"); 83 | break; 84 | 85 | case "[bold green]Update Candidate[/]": 86 | UpdateCandidate(); 87 | break; 88 | 89 | case "[bold yellow]View Results[/]": 90 | AnsiConsole.MarkupLine("[bold cyan]===== Voting Results =====[/]"); 91 | List results = votingService.GetCandidates(); 92 | foreach (var candidate in results) 93 | { 94 | AnsiConsole.MarkupLine($"[bold white]{candidate.Name}[/]: [bold yellow]{candidate.Votes} votes[/]"); 95 | } 96 | break; 97 | case "[bold yellow]View Voters[/]": 98 | AnsiConsole.MarkupLine("[bold cyan]===== Voting Voters =====[/]"); 99 | List voters = votingService.GetVoters(); 100 | foreach (var voter in voters) 101 | { 102 | AnsiConsole.MarkupLine("[bold blue3_1]======================================================[/]"); 103 | AnsiConsole.MarkupLine($"[bold yellow]Name[/]: {voter.Name}"); 104 | AnsiConsole.MarkupLine($"[bold white]Email[/]: {voter.Email}"); 105 | AnsiConsole.MarkupLine($"[bold yellow]Has Voted[/]: {voter.HasVoted}"); 106 | await Console.Out.WriteLineAsync(); 107 | } 108 | break; 109 | case "[bold red]Exit[/]": 110 | return; 111 | } 112 | 113 | AnsiConsole.WriteLine(); 114 | AnsiConsole.MarkupLine("[bold white]Press any key to continue...[/]"); 115 | Console.ReadLine(); 116 | } 117 | } 118 | else 119 | { 120 | await votinUi.Run(account); 121 | } 122 | } 123 | else 124 | { 125 | return; 126 | } 127 | } 128 | } 129 | 130 | private void UpdateCandidate() 131 | { 132 | List candidates = candidateService.GetCandidates(); 133 | var candidate = AnsiConsole.Prompt( 134 | new SelectionPrompt() 135 | .Title("[bold cyan]Available candidates:[/]") 136 | .PageSize(10) 137 | .AddChoices(candidates) 138 | .UseConverter(c => c.Name) 139 | ); 140 | 141 | var newName = AnsiConsole.Ask("Enter new name ", candidate.Name); 142 | if (newName != null) 143 | { 144 | candidateService.UpdateCandidateName(candidate.Id, newName); 145 | AnsiConsole.MarkupLine("[bold green]Name changed successfully.[/]"); 146 | } 147 | } 148 | } 149 | 150 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | # Uncomment if you have tasks that create the project's static files in wwwroot 39 | #wwwroot/ 40 | 41 | # Visual Studio 2017 auto generated files 42 | Generated\ Files/ 43 | 44 | # MSTest test Results 45 | [Tt]est[Rr]esult*/ 46 | [Bb]uild[Ll]og.* 47 | 48 | # NUnit 49 | *.VisualState.xml 50 | TestResult.xml 51 | nunit-*.xml 52 | 53 | # Build Results of an ATL Project 54 | [Dd]ebugPS/ 55 | [Rr]eleasePS/ 56 | dlldata.c 57 | 58 | # Benchmark Results 59 | BenchmarkDotNet.Artifacts/ 60 | 61 | # .NET Core 62 | project.lock.json 63 | project.fragment.lock.json 64 | artifacts/ 65 | 66 | # ASP.NET Scaffolding 67 | ScaffoldingReadMe.txt 68 | 69 | # StyleCop 70 | StyleCopReport.xml 71 | 72 | # Files built by Visual Studio 73 | *_i.c 74 | *_p.c 75 | *_h.h 76 | *.ilk 77 | *.meta 78 | *.obj 79 | *.iobj 80 | *.pch 81 | *.pdb 82 | *.ipdb 83 | *.pgc 84 | *.pgd 85 | *.rsp 86 | *.sbr 87 | *.tlb 88 | *.tli 89 | *.tlh 90 | *.tmp 91 | *.tmp_proj 92 | *_wpftmp.csproj 93 | *.log 94 | *.vspscc 95 | *.vssscc 96 | .builds 97 | *.pidb 98 | *.svclog 99 | *.scc 100 | 101 | # Chutzpah Test files 102 | _Chutzpah* 103 | 104 | # Visual C++ cache files 105 | ipch/ 106 | *.aps 107 | *.ncb 108 | *.opendb 109 | *.opensdf 110 | *.sdf 111 | *.cachefile 112 | *.VC.db 113 | *.VC.VC.opendb 114 | 115 | # Visual Studio profiler 116 | *.psess 117 | *.vsp 118 | *.vspx 119 | *.sap 120 | 121 | # Visual Studio Trace Files 122 | *.e2e 123 | 124 | # TFS 2012 Local Workspace 125 | $tf/ 126 | 127 | # Guidance Automation Toolkit 128 | *.gpState 129 | 130 | # ReSharper is a .NET coding add-in 131 | _ReSharper*/ 132 | *.[Rr]e[Ss]harper 133 | *.DotSettings.user 134 | 135 | # TeamCity is a build add-in 136 | _TeamCity* 137 | 138 | # DotCover is a Code Coverage Tool 139 | *.dotCover 140 | 141 | # AxoCover is a Code Coverage Tool 142 | .axoCover/* 143 | !.axoCover/settings.json 144 | 145 | # Coverlet is a free, cross platform Code Coverage Tool 146 | coverage*.json 147 | coverage*.xml 148 | coverage*.info 149 | 150 | # Visual Studio code coverage results 151 | *.coverage 152 | *.coveragexml 153 | 154 | # NCrunch 155 | _NCrunch_* 156 | .*crunch*.local.xml 157 | nCrunchTemp_* 158 | 159 | # MightyMoose 160 | *.mm.* 161 | AutoTest.Net/ 162 | 163 | # Web workbench (sass) 164 | .sass-cache/ 165 | 166 | # Installshield output folder 167 | [Ee]xpress/ 168 | 169 | # DocProject is a documentation generator add-in 170 | DocProject/buildhelp/ 171 | DocProject/Help/*.HxT 172 | DocProject/Help/*.HxC 173 | DocProject/Help/*.hhc 174 | DocProject/Help/*.hhk 175 | DocProject/Help/*.hhp 176 | DocProject/Help/Html2 177 | DocProject/Help/html 178 | 179 | # Click-Once directory 180 | publish/ 181 | 182 | # Publish Web Output 183 | *.[Pp]ublish.xml 184 | *.azurePubxml 185 | # Note: Comment the next line if you want to checkin your web deploy settings, 186 | # but database connection strings (with potential passwords) will be unencrypted 187 | *.pubxml 188 | *.publishproj 189 | 190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 191 | # checkin your Azure Web App publish settings, but sensitive information contained 192 | # in these scripts will be unencrypted 193 | PublishScripts/ 194 | 195 | # NuGet Packages 196 | *.nupkg 197 | # NuGet Symbol Packages 198 | *.snupkg 199 | # The packages folder can be ignored because of Package Restore 200 | **/[Pp]ackages/* 201 | # except build/, which is used as an MSBuild target. 202 | !**/[Pp]ackages/build/ 203 | # Uncomment if necessary however generally it will be regenerated when needed 204 | #!**/[Pp]ackages/repositories.config 205 | # NuGet v3's project.json files produces more ignorable files 206 | *.nuget.props 207 | *.nuget.targets 208 | 209 | # Microsoft Azure Build Output 210 | csx/ 211 | *.build.csdef 212 | 213 | # Microsoft Azure Emulator 214 | ecf/ 215 | rcf/ 216 | 217 | # Windows Store app package directories and files 218 | AppPackages/ 219 | BundleArtifacts/ 220 | Package.StoreAssociation.xml 221 | _pkginfo.txt 222 | *.appx 223 | *.appxbundle 224 | *.appxupload 225 | 226 | # Visual Studio cache files 227 | # files ending in .cache can be ignored 228 | *.[Cc]ache 229 | # but keep track of directories ending in .cache 230 | !?*.[Cc]ache/ 231 | 232 | # Others 233 | ClientBin/ 234 | ~$* 235 | *~ 236 | *.dbmdl 237 | *.dbproj.schemaview 238 | *.jfm 239 | *.pfx 240 | *.publishsettings 241 | orleans.codegen.cs 242 | 243 | # Including strong name files can present a security risk 244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 245 | #*.snk 246 | 247 | # Since there are multiple workflows, uncomment next line to ignore bower_components 248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 249 | #bower_components/ 250 | 251 | # RIA/Silverlight projects 252 | Generated_Code/ 253 | 254 | # Backup & report files from converting an old project file 255 | # to a newer Visual Studio version. Backup files are not needed, 256 | # because we have git ;-) 257 | _UpgradeReport_Files/ 258 | Backup*/ 259 | UpgradeLog*.XML 260 | UpgradeLog*.htm 261 | ServiceFabricBackup/ 262 | *.rptproj.bak 263 | 264 | # SQL Server files 265 | *.mdf 266 | *.ldf 267 | *.ndf 268 | 269 | # Business Intelligence projects 270 | *.rdl.data 271 | *.bim.layout 272 | *.bim_*.settings 273 | *.rptproj.rsuser 274 | *- [Bb]ackup.rdl 275 | *- [Bb]ackup ([0-9]).rdl 276 | *- [Bb]ackup ([0-9][0-9]).rdl 277 | 278 | # Microsoft Fakes 279 | FakesAssemblies/ 280 | 281 | # GhostDoc plugin setting file 282 | *.GhostDoc.xml 283 | 284 | # Node.js Tools for Visual Studio 285 | .ntvs_analysis.dat 286 | node_modules/ 287 | 288 | # Visual Studio 6 build log 289 | *.plg 290 | 291 | # Visual Studio 6 workspace options file 292 | *.opt 293 | 294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 295 | *.vbw 296 | 297 | # Visual Studio LightSwitch build output 298 | **/*.HTMLClient/GeneratedArtifacts 299 | **/*.DesktopClient/GeneratedArtifacts 300 | **/*.DesktopClient/ModelManifest.xml 301 | **/*.Server/GeneratedArtifacts 302 | **/*.Server/ModelManifest.xml 303 | _Pvt_Extensions 304 | 305 | # Paket dependency manager 306 | .paket/paket.exe 307 | paket-files/ 308 | 309 | # FAKE - F# Make 310 | .fake/ 311 | 312 | # CodeRush personal settings 313 | .cr/personal 314 | 315 | # Python Tools for Visual Studio (PTVS) 316 | __pycache__/ 317 | *.pyc 318 | 319 | # Cake - Uncomment if you are using it 320 | # tools/** 321 | # !tools/packages.config 322 | 323 | # Tabs Studio 324 | *.tss 325 | 326 | # Telerik's JustMock configuration file 327 | *.jmconfig 328 | 329 | # BizTalk build output 330 | *.btp.cs 331 | *.btm.cs 332 | *.odx.cs 333 | *.xsd.cs 334 | 335 | # OpenCover UI analysis results 336 | OpenCover/ 337 | 338 | # Azure Stream Analytics local run output 339 | ASALocalRun/ 340 | 341 | # MSBuild Binary and Structured Log 342 | *.binlog 343 | 344 | # NVidia Nsight GPU debugger configuration file 345 | *.nvuser 346 | 347 | # MFractors (Xamarin productivity tool) working folder 348 | .mfractor/ 349 | 350 | # Local History for Visual Studio 351 | .localhistory/ 352 | 353 | # BeatPulse healthcheck temp database 354 | healthchecksdb 355 | 356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 357 | MigrationBackup/ 358 | 359 | # Ionide (cross platform F# VS Code tools) working folder 360 | .ionide/ 361 | 362 | # Fody - auto-generated XML schema 363 | FodyWeavers.xsd --------------------------------------------------------------------------------