├── .gitignore ├── BookStore └── BookStore.API │ ├── BookStore.API.sln │ └── BookStore.API │ ├── BookStore.API.csproj │ ├── Controllers │ ├── AccountController.cs │ ├── BooksController.cs │ └── WeatherForecastController.cs │ ├── Data │ ├── BookStoreContext.cs │ └── Books.cs │ ├── Helpers │ └── ApplicationMapper.cs │ ├── Migrations │ ├── 20210305171517_init.Designer.cs │ ├── 20210305171517_init.cs │ ├── 20210316181835_AddedIdentity.Designer.cs │ ├── 20210316181835_AddedIdentity.cs │ └── BookStoreContextModelSnapshot.cs │ ├── Models │ ├── ApplicationUser.cs │ ├── BookModel.cs │ ├── SignInModel.cs │ └── SignUpModel.cs │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Repository │ ├── AccountRepository.cs │ ├── BookRepository.cs │ ├── IAccountRepository.cs │ └── IBookRepository.cs │ ├── Startup.cs │ ├── WeatherForecast.cs │ ├── appsettings.Development.json │ ├── appsettings.json │ └── libman.json ├── BookStoreWebApp ├── .browserslistrc ├── .editorconfig ├── .gitignore ├── README.md ├── angular.json ├── e2e │ ├── protractor.conf.js │ ├── src │ │ ├── app.e2e-spec.ts │ │ └── app.po.ts │ └── tsconfig.json ├── karma.conf.js ├── package-lock.json ├── package.json ├── src │ ├── app │ │ ├── add-book │ │ │ ├── add-book.component.html │ │ │ ├── add-book.component.scss │ │ │ ├── add-book.component.spec.ts │ │ │ └── add-book.component.ts │ │ ├── all-books │ │ │ ├── all-books.component.html │ │ │ ├── all-books.component.scss │ │ │ ├── all-books.component.spec.ts │ │ │ └── all-books.component.ts │ │ ├── app-routing.module.ts │ │ ├── app.component.html │ │ ├── app.component.scss │ │ ├── app.component.spec.ts │ │ ├── app.component.ts │ │ ├── app.module.ts │ │ ├── book.service.spec.ts │ │ └── book.service.ts │ ├── assets │ │ └── .gitkeep │ ├── environments │ │ ├── environment.prod.ts │ │ └── environment.ts │ ├── favicon.ico │ ├── index.html │ ├── main.ts │ ├── polyfills.ts │ ├── styles.scss │ └── test.ts ├── tsconfig.app.json ├── tsconfig.json ├── tsconfig.spec.json └── tslint.json ├── Fundamentals ├── ConsoleToWebAPI.sln └── ConsoleToWebAPI │ ├── ConsoleToWebAPI.csproj │ ├── ConsoleToWebAPI.csproj.user │ ├── Controllers │ ├── AnimalsController.cs │ ├── BooksController.cs │ ├── CountriesController.cs │ ├── EmployeeController.cs │ ├── ProductController.cs │ ├── TestController.cs │ └── ValuesController.cs │ ├── CustomBinder.cs │ ├── CustomBinderCountryDetails.cs │ ├── CustomMiddleware1.cs │ ├── Models │ ├── AnimalModel.cs │ ├── CountryModel.cs │ ├── EmployeeModel.cs │ └── ProductModel.cs │ ├── Program.cs │ ├── Properties │ └── launchSettings.json │ ├── Repository │ ├── IProductRepository.cs │ ├── ProductRepository.cs │ └── TestRepository.cs │ ├── Startup.cs │ ├── bin │ └── Debug │ │ ├── net5.0 │ │ ├── ConsoleToWebAPI.deps.json │ │ ├── ConsoleToWebAPI.dll │ │ ├── ConsoleToWebAPI.exe │ │ ├── ConsoleToWebAPI.pdb │ │ ├── ConsoleToWebAPI.runtimeconfig.dev.json │ │ ├── ConsoleToWebAPI.runtimeconfig.json │ │ └── ref │ │ │ └── ConsoleToWebAPI.dll │ │ └── netcoreapp3.1 │ │ ├── ConsoleToWebAPI.deps.json │ │ ├── ConsoleToWebAPI.dll │ │ ├── ConsoleToWebAPI.exe │ │ ├── ConsoleToWebAPI.pdb │ │ ├── ConsoleToWebAPI.runtimeconfig.dev.json │ │ └── ConsoleToWebAPI.runtimeconfig.json │ └── obj │ ├── ConsoleToWebAPI.csproj.nuget.dgspec.json │ ├── ConsoleToWebAPI.csproj.nuget.g.props │ ├── ConsoleToWebAPI.csproj.nuget.g.targets │ ├── Debug │ ├── net5.0 │ │ ├── .NETCoreApp,Version=v5.0.AssemblyAttributes.cs │ │ ├── ConsoleToWebAPI.AssemblyInfo.cs │ │ ├── ConsoleToWebAPI.AssemblyInfoInputs.cache │ │ ├── ConsoleToWebAPI.GeneratedMSBuildEditorConfig.editorconfig │ │ ├── ConsoleToWebAPI.MvcApplicationPartsAssemblyInfo.cache │ │ ├── ConsoleToWebAPI.RazorTargetAssemblyInfo.cache │ │ ├── ConsoleToWebAPI.assets.cache │ │ ├── ConsoleToWebAPI.csproj.CoreCompileInputs.cache │ │ ├── ConsoleToWebAPI.csproj.FileListAbsolute.txt │ │ ├── ConsoleToWebAPI.csprojAssemblyReference.cache │ │ ├── ConsoleToWebAPI.dll │ │ ├── ConsoleToWebAPI.genruntimeconfig.cache │ │ ├── ConsoleToWebAPI.pdb │ │ ├── apphost.exe │ │ ├── ref │ │ │ └── ConsoleToWebAPI.dll │ │ └── staticwebassets │ │ │ ├── ConsoleToWebAPI.StaticWebAssets.Manifest.cache │ │ │ └── ConsoleToWebAPI.StaticWebAssets.xml │ └── netcoreapp3.1 │ │ ├── .NETCoreApp,Version=v3.1.AssemblyAttributes.cs │ │ ├── ConsoleToWebAPI.AssemblyInfo.cs │ │ ├── ConsoleToWebAPI.AssemblyInfoInputs.cache │ │ ├── ConsoleToWebAPI.assets.cache │ │ ├── ConsoleToWebAPI.csproj.CoreCompileInputs.cache │ │ ├── ConsoleToWebAPI.csproj.FileListAbsolute.txt │ │ ├── ConsoleToWebAPI.csprojAssemblyReference.cache │ │ ├── ConsoleToWebAPI.dll │ │ ├── ConsoleToWebAPI.genruntimeconfig.cache │ │ ├── ConsoleToWebAPI.pdb │ │ └── apphost.exe │ ├── project.assets.json │ └── project.nuget.cache ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # This .gitignore file was automatically created by Microsoft(R) Visual Studio. 3 | ################################################################################ 4 | 5 | *.vs 6 | *.user 7 | *.dll 8 | /Fundamentals/ConsoleToWebAPI/bin 9 | /Fundamentals/ConsoleToWebAPI/obj 10 | /BookStore/BookStore.API/BookStore.API/bin 11 | /BookStore/BookStore.API/BookStore.API/obj 12 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30907.101 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BookStore.API", "BookStore.API\BookStore.API.csproj", "{CAD1ABD9-C453-4BED-943B-3C2CBA15A373}" 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 | {CAD1ABD9-C453-4BED-943B-3C2CBA15A373}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {CAD1ABD9-C453-4BED-943B-3C2CBA15A373}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {CAD1ABD9-C453-4BED-943B-3C2CBA15A373}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {CAD1ABD9-C453-4BED-943B-3C2CBA15A373}.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 = {2A89E2D5-D352-4D1B-8888-29BC08B22D62} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/BookStore.API.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | all 15 | runtime; build; native; contentfiles; analyzers; buildtransitive 16 | 17 | 18 | 19 | all 20 | runtime; build; native; contentfiles; analyzers; buildtransitive 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Controllers/AccountController.cs: -------------------------------------------------------------------------------- 1 | using BookStore.API.Models; 2 | using BookStore.API.Repository; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace BookStore.API.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class AccountController : ControllerBase 15 | { 16 | private readonly IAccountRepository _accountRepository; 17 | 18 | public AccountController(IAccountRepository accountRepository) 19 | { 20 | _accountRepository = accountRepository; 21 | } 22 | 23 | [HttpPost("signup")] 24 | public async Task SignUp([FromBody] SignUpModel signUpModel) 25 | { 26 | var result = await _accountRepository.SignUpAsync(signUpModel); 27 | 28 | if (result.Succeeded) 29 | { 30 | return Ok(result.Succeeded); 31 | } 32 | 33 | return Unauthorized(); 34 | } 35 | 36 | [HttpPost("login")] 37 | public async Task Login([FromBody] SignInModel signInModel) 38 | { 39 | var result = await _accountRepository.LoginAsync(signInModel); 40 | 41 | if (string.IsNullOrEmpty(result)) 42 | { 43 | return Unauthorized(); 44 | } 45 | 46 | return Ok(result); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Controllers/BooksController.cs: -------------------------------------------------------------------------------- 1 | using BookStore.API.Models; 2 | using BookStore.API.Repository; 3 | using Microsoft.AspNetCore.Authorization; 4 | using Microsoft.AspNetCore.Http; 5 | using Microsoft.AspNetCore.JsonPatch; 6 | using Microsoft.AspNetCore.Mvc; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Threading.Tasks; 11 | 12 | namespace BookStore.API.Controllers 13 | { 14 | [Route("api/[controller]")] 15 | [ApiController] 16 | [Authorize] 17 | public class BooksController : ControllerBase 18 | { 19 | private readonly IBookRepository _bookRepository; 20 | 21 | public BooksController(IBookRepository bookRepository) 22 | { 23 | _bookRepository = bookRepository; 24 | } 25 | 26 | [HttpGet("")] 27 | 28 | public async Task GetAllBooks() 29 | { 30 | var books = await _bookRepository.GetAllBooksAsync(); 31 | return Ok(books); 32 | } 33 | 34 | [HttpGet("{id}")] 35 | public async Task GetBookById([FromRoute] int id) 36 | { 37 | var book = await _bookRepository.GetBookByIdAsync(id); 38 | if (book == null) 39 | { 40 | return NotFound(); 41 | } 42 | return Ok(book); 43 | } 44 | 45 | [HttpPost("")] 46 | public async Task AddNewBook([FromBody] BookModel bookModel) 47 | { 48 | var id = await _bookRepository.AddBookAsync(bookModel); 49 | return CreatedAtAction(nameof(GetBookById), new { id = id, controller = "books" }, id); 50 | } 51 | 52 | [HttpPut("{id}")] 53 | public async Task UpdateBook([FromBody] BookModel bookModel, [FromRoute] int id) 54 | { 55 | await _bookRepository.UpdateBookAsync(id, bookModel); 56 | return Ok(); 57 | } 58 | 59 | [HttpPatch("{id}")] 60 | public async Task UpdateBookPatch([FromBody] JsonPatchDocument bookModel, [FromRoute] int id) 61 | { 62 | await _bookRepository.UpdateBookPatchAsync(id, bookModel); 63 | return Ok(); 64 | } 65 | 66 | [HttpDelete("{id}")] 67 | public async Task DeleteBook([FromRoute] int id) 68 | { 69 | await _bookRepository.DeleteBookAsync(id); 70 | return Ok(); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Controllers/WeatherForecastController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.Extensions.Logging; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace BookStore.API.Controllers 9 | { 10 | [ApiController] 11 | [Route("[controller]")] 12 | public class WeatherForecastController : ControllerBase 13 | { 14 | private static readonly string[] Summaries = new[] 15 | { 16 | "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 17 | }; 18 | 19 | private readonly ILogger _logger; 20 | 21 | public WeatherForecastController(ILogger logger) 22 | { 23 | _logger = logger; 24 | } 25 | 26 | [HttpGet] 27 | public IEnumerable Get() 28 | { 29 | var rng = new Random(); 30 | return Enumerable.Range(1, 5).Select(index => new WeatherForecast 31 | { 32 | Date = DateTime.Now.AddDays(index), 33 | TemperatureC = rng.Next(-20, 55), 34 | Summary = Summaries[rng.Next(Summaries.Length)] 35 | }) 36 | .ToArray(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Data/BookStoreContext.cs: -------------------------------------------------------------------------------- 1 | using BookStore.API.Models; 2 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore; 3 | using Microsoft.EntityFrameworkCore; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | 9 | namespace BookStore.API.Data 10 | { 11 | public class BookStoreContext : IdentityDbContext 12 | { 13 | public BookStoreContext(DbContextOptions options) 14 | : base(options) 15 | { 16 | } 17 | 18 | public DbSet Books { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Data/Books.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace BookStore.API.Data 7 | { 8 | public class Books 9 | { 10 | public int Id { get; set; } 11 | public string Title { get; set; } 12 | public string Description { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Helpers/ApplicationMapper.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using BookStore.API.Data; 3 | using BookStore.API.Models; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | 9 | namespace BookStore.API.Helpers 10 | { 11 | public class ApplicationMapper : Profile 12 | { 13 | public ApplicationMapper() 14 | { 15 | CreateMap().ReverseMap(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Migrations/20210305171517_init.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using BookStore.API.Data; 3 | using Microsoft.EntityFrameworkCore; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Metadata; 6 | using Microsoft.EntityFrameworkCore.Migrations; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | 9 | namespace BookStore.API.Migrations 10 | { 11 | [DbContext(typeof(BookStoreContext))] 12 | [Migration("20210305171517_init")] 13 | partial class init 14 | { 15 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 16 | { 17 | #pragma warning disable 612, 618 18 | modelBuilder 19 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 20 | .HasAnnotation("ProductVersion", "5.0.3") 21 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 22 | 23 | modelBuilder.Entity("BookStore.API.Data.Books", b => 24 | { 25 | b.Property("Id") 26 | .ValueGeneratedOnAdd() 27 | .HasColumnType("int") 28 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 29 | 30 | b.Property("Description") 31 | .HasColumnType("nvarchar(max)"); 32 | 33 | b.Property("Title") 34 | .HasColumnType("nvarchar(max)"); 35 | 36 | b.HasKey("Id"); 37 | 38 | b.ToTable("Books"); 39 | }); 40 | #pragma warning restore 612, 618 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Migrations/20210305171517_init.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | namespace BookStore.API.Migrations 4 | { 5 | public partial class init : Migration 6 | { 7 | protected override void Up(MigrationBuilder migrationBuilder) 8 | { 9 | migrationBuilder.CreateTable( 10 | name: "Books", 11 | columns: table => new 12 | { 13 | Id = table.Column(type: "int", nullable: false) 14 | .Annotation("SqlServer:Identity", "1, 1"), 15 | Title = table.Column(type: "nvarchar(max)", nullable: true), 16 | Description = table.Column(type: "nvarchar(max)", nullable: true) 17 | }, 18 | constraints: table => 19 | { 20 | table.PrimaryKey("PK_Books", x => x.Id); 21 | }); 22 | } 23 | 24 | protected override void Down(MigrationBuilder migrationBuilder) 25 | { 26 | migrationBuilder.DropTable( 27 | name: "Books"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Migrations/20210316181835_AddedIdentity.Designer.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using BookStore.API.Data; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Migrations; 8 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 9 | 10 | namespace BookStore.API.Migrations 11 | { 12 | [DbContext(typeof(BookStoreContext))] 13 | [Migration("20210316181835_AddedIdentity")] 14 | partial class AddedIdentity 15 | { 16 | protected override void BuildTargetModel(ModelBuilder modelBuilder) 17 | { 18 | #pragma warning disable 612, 618 19 | modelBuilder 20 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 21 | .HasAnnotation("ProductVersion", "5.0.4") 22 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 23 | 24 | modelBuilder.Entity("BookStore.API.Data.Books", b => 25 | { 26 | b.Property("Id") 27 | .ValueGeneratedOnAdd() 28 | .HasColumnType("int") 29 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 30 | 31 | b.Property("Description") 32 | .HasColumnType("nvarchar(max)"); 33 | 34 | b.Property("Title") 35 | .HasColumnType("nvarchar(max)"); 36 | 37 | b.HasKey("Id"); 38 | 39 | b.ToTable("Books"); 40 | }); 41 | 42 | modelBuilder.Entity("BookStore.API.Models.ApplicationUser", b => 43 | { 44 | b.Property("Id") 45 | .HasColumnType("nvarchar(450)"); 46 | 47 | b.Property("AccessFailedCount") 48 | .HasColumnType("int"); 49 | 50 | b.Property("ConcurrencyStamp") 51 | .IsConcurrencyToken() 52 | .HasColumnType("nvarchar(max)"); 53 | 54 | b.Property("Email") 55 | .HasMaxLength(256) 56 | .HasColumnType("nvarchar(256)"); 57 | 58 | b.Property("EmailConfirmed") 59 | .HasColumnType("bit"); 60 | 61 | b.Property("FirstName") 62 | .HasColumnType("nvarchar(max)"); 63 | 64 | b.Property("LastName") 65 | .HasColumnType("nvarchar(max)"); 66 | 67 | b.Property("LockoutEnabled") 68 | .HasColumnType("bit"); 69 | 70 | b.Property("LockoutEnd") 71 | .HasColumnType("datetimeoffset"); 72 | 73 | b.Property("NormalizedEmail") 74 | .HasMaxLength(256) 75 | .HasColumnType("nvarchar(256)"); 76 | 77 | b.Property("NormalizedUserName") 78 | .HasMaxLength(256) 79 | .HasColumnType("nvarchar(256)"); 80 | 81 | b.Property("PasswordHash") 82 | .HasColumnType("nvarchar(max)"); 83 | 84 | b.Property("PhoneNumber") 85 | .HasColumnType("nvarchar(max)"); 86 | 87 | b.Property("PhoneNumberConfirmed") 88 | .HasColumnType("bit"); 89 | 90 | b.Property("SecurityStamp") 91 | .HasColumnType("nvarchar(max)"); 92 | 93 | b.Property("TwoFactorEnabled") 94 | .HasColumnType("bit"); 95 | 96 | b.Property("UserName") 97 | .HasMaxLength(256) 98 | .HasColumnType("nvarchar(256)"); 99 | 100 | b.HasKey("Id"); 101 | 102 | b.HasIndex("NormalizedEmail") 103 | .HasDatabaseName("EmailIndex"); 104 | 105 | b.HasIndex("NormalizedUserName") 106 | .IsUnique() 107 | .HasDatabaseName("UserNameIndex") 108 | .HasFilter("[NormalizedUserName] IS NOT NULL"); 109 | 110 | b.ToTable("AspNetUsers"); 111 | }); 112 | 113 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => 114 | { 115 | b.Property("Id") 116 | .HasColumnType("nvarchar(450)"); 117 | 118 | b.Property("ConcurrencyStamp") 119 | .IsConcurrencyToken() 120 | .HasColumnType("nvarchar(max)"); 121 | 122 | b.Property("Name") 123 | .HasMaxLength(256) 124 | .HasColumnType("nvarchar(256)"); 125 | 126 | b.Property("NormalizedName") 127 | .HasMaxLength(256) 128 | .HasColumnType("nvarchar(256)"); 129 | 130 | b.HasKey("Id"); 131 | 132 | b.HasIndex("NormalizedName") 133 | .IsUnique() 134 | .HasDatabaseName("RoleNameIndex") 135 | .HasFilter("[NormalizedName] IS NOT NULL"); 136 | 137 | b.ToTable("AspNetRoles"); 138 | }); 139 | 140 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 141 | { 142 | b.Property("Id") 143 | .ValueGeneratedOnAdd() 144 | .HasColumnType("int") 145 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 146 | 147 | b.Property("ClaimType") 148 | .HasColumnType("nvarchar(max)"); 149 | 150 | b.Property("ClaimValue") 151 | .HasColumnType("nvarchar(max)"); 152 | 153 | b.Property("RoleId") 154 | .IsRequired() 155 | .HasColumnType("nvarchar(450)"); 156 | 157 | b.HasKey("Id"); 158 | 159 | b.HasIndex("RoleId"); 160 | 161 | b.ToTable("AspNetRoleClaims"); 162 | }); 163 | 164 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 165 | { 166 | b.Property("Id") 167 | .ValueGeneratedOnAdd() 168 | .HasColumnType("int") 169 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 170 | 171 | b.Property("ClaimType") 172 | .HasColumnType("nvarchar(max)"); 173 | 174 | b.Property("ClaimValue") 175 | .HasColumnType("nvarchar(max)"); 176 | 177 | b.Property("UserId") 178 | .IsRequired() 179 | .HasColumnType("nvarchar(450)"); 180 | 181 | b.HasKey("Id"); 182 | 183 | b.HasIndex("UserId"); 184 | 185 | b.ToTable("AspNetUserClaims"); 186 | }); 187 | 188 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 189 | { 190 | b.Property("LoginProvider") 191 | .HasColumnType("nvarchar(450)"); 192 | 193 | b.Property("ProviderKey") 194 | .HasColumnType("nvarchar(450)"); 195 | 196 | b.Property("ProviderDisplayName") 197 | .HasColumnType("nvarchar(max)"); 198 | 199 | b.Property("UserId") 200 | .IsRequired() 201 | .HasColumnType("nvarchar(450)"); 202 | 203 | b.HasKey("LoginProvider", "ProviderKey"); 204 | 205 | b.HasIndex("UserId"); 206 | 207 | b.ToTable("AspNetUserLogins"); 208 | }); 209 | 210 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 211 | { 212 | b.Property("UserId") 213 | .HasColumnType("nvarchar(450)"); 214 | 215 | b.Property("RoleId") 216 | .HasColumnType("nvarchar(450)"); 217 | 218 | b.HasKey("UserId", "RoleId"); 219 | 220 | b.HasIndex("RoleId"); 221 | 222 | b.ToTable("AspNetUserRoles"); 223 | }); 224 | 225 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 226 | { 227 | b.Property("UserId") 228 | .HasColumnType("nvarchar(450)"); 229 | 230 | b.Property("LoginProvider") 231 | .HasColumnType("nvarchar(450)"); 232 | 233 | b.Property("Name") 234 | .HasColumnType("nvarchar(450)"); 235 | 236 | b.Property("Value") 237 | .HasColumnType("nvarchar(max)"); 238 | 239 | b.HasKey("UserId", "LoginProvider", "Name"); 240 | 241 | b.ToTable("AspNetUserTokens"); 242 | }); 243 | 244 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 245 | { 246 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) 247 | .WithMany() 248 | .HasForeignKey("RoleId") 249 | .OnDelete(DeleteBehavior.Cascade) 250 | .IsRequired(); 251 | }); 252 | 253 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 254 | { 255 | b.HasOne("BookStore.API.Models.ApplicationUser", null) 256 | .WithMany() 257 | .HasForeignKey("UserId") 258 | .OnDelete(DeleteBehavior.Cascade) 259 | .IsRequired(); 260 | }); 261 | 262 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 263 | { 264 | b.HasOne("BookStore.API.Models.ApplicationUser", null) 265 | .WithMany() 266 | .HasForeignKey("UserId") 267 | .OnDelete(DeleteBehavior.Cascade) 268 | .IsRequired(); 269 | }); 270 | 271 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 272 | { 273 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) 274 | .WithMany() 275 | .HasForeignKey("RoleId") 276 | .OnDelete(DeleteBehavior.Cascade) 277 | .IsRequired(); 278 | 279 | b.HasOne("BookStore.API.Models.ApplicationUser", null) 280 | .WithMany() 281 | .HasForeignKey("UserId") 282 | .OnDelete(DeleteBehavior.Cascade) 283 | .IsRequired(); 284 | }); 285 | 286 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 287 | { 288 | b.HasOne("BookStore.API.Models.ApplicationUser", null) 289 | .WithMany() 290 | .HasForeignKey("UserId") 291 | .OnDelete(DeleteBehavior.Cascade) 292 | .IsRequired(); 293 | }); 294 | #pragma warning restore 612, 618 295 | } 296 | } 297 | } 298 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Migrations/20210316181835_AddedIdentity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | namespace BookStore.API.Migrations 5 | { 6 | public partial class AddedIdentity : Migration 7 | { 8 | protected override void Up(MigrationBuilder migrationBuilder) 9 | { 10 | migrationBuilder.CreateTable( 11 | name: "AspNetRoles", 12 | columns: table => new 13 | { 14 | Id = table.Column(type: "nvarchar(450)", nullable: false), 15 | Name = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 16 | NormalizedName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 17 | ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true) 18 | }, 19 | constraints: table => 20 | { 21 | table.PrimaryKey("PK_AspNetRoles", x => x.Id); 22 | }); 23 | 24 | migrationBuilder.CreateTable( 25 | name: "AspNetUsers", 26 | columns: table => new 27 | { 28 | Id = table.Column(type: "nvarchar(450)", nullable: false), 29 | FirstName = table.Column(type: "nvarchar(max)", nullable: true), 30 | LastName = table.Column(type: "nvarchar(max)", nullable: true), 31 | UserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 32 | NormalizedUserName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 33 | Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 34 | NormalizedEmail = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), 35 | EmailConfirmed = table.Column(type: "bit", nullable: false), 36 | PasswordHash = table.Column(type: "nvarchar(max)", nullable: true), 37 | SecurityStamp = table.Column(type: "nvarchar(max)", nullable: true), 38 | ConcurrencyStamp = table.Column(type: "nvarchar(max)", nullable: true), 39 | PhoneNumber = table.Column(type: "nvarchar(max)", nullable: true), 40 | PhoneNumberConfirmed = table.Column(type: "bit", nullable: false), 41 | TwoFactorEnabled = table.Column(type: "bit", nullable: false), 42 | LockoutEnd = table.Column(type: "datetimeoffset", nullable: true), 43 | LockoutEnabled = table.Column(type: "bit", nullable: false), 44 | AccessFailedCount = table.Column(type: "int", nullable: false) 45 | }, 46 | constraints: table => 47 | { 48 | table.PrimaryKey("PK_AspNetUsers", x => x.Id); 49 | }); 50 | 51 | migrationBuilder.CreateTable( 52 | name: "AspNetRoleClaims", 53 | columns: table => new 54 | { 55 | Id = table.Column(type: "int", nullable: false) 56 | .Annotation("SqlServer:Identity", "1, 1"), 57 | RoleId = table.Column(type: "nvarchar(450)", nullable: false), 58 | ClaimType = table.Column(type: "nvarchar(max)", nullable: true), 59 | ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) 60 | }, 61 | constraints: table => 62 | { 63 | table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); 64 | table.ForeignKey( 65 | name: "FK_AspNetRoleClaims_AspNetRoles_RoleId", 66 | column: x => x.RoleId, 67 | principalTable: "AspNetRoles", 68 | principalColumn: "Id", 69 | onDelete: ReferentialAction.Cascade); 70 | }); 71 | 72 | migrationBuilder.CreateTable( 73 | name: "AspNetUserClaims", 74 | columns: table => new 75 | { 76 | Id = table.Column(type: "int", nullable: false) 77 | .Annotation("SqlServer:Identity", "1, 1"), 78 | UserId = table.Column(type: "nvarchar(450)", nullable: false), 79 | ClaimType = table.Column(type: "nvarchar(max)", nullable: true), 80 | ClaimValue = table.Column(type: "nvarchar(max)", nullable: true) 81 | }, 82 | constraints: table => 83 | { 84 | table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); 85 | table.ForeignKey( 86 | name: "FK_AspNetUserClaims_AspNetUsers_UserId", 87 | column: x => x.UserId, 88 | principalTable: "AspNetUsers", 89 | principalColumn: "Id", 90 | onDelete: ReferentialAction.Cascade); 91 | }); 92 | 93 | migrationBuilder.CreateTable( 94 | name: "AspNetUserLogins", 95 | columns: table => new 96 | { 97 | LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), 98 | ProviderKey = table.Column(type: "nvarchar(450)", nullable: false), 99 | ProviderDisplayName = table.Column(type: "nvarchar(max)", nullable: true), 100 | UserId = table.Column(type: "nvarchar(450)", nullable: false) 101 | }, 102 | constraints: table => 103 | { 104 | table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey }); 105 | table.ForeignKey( 106 | name: "FK_AspNetUserLogins_AspNetUsers_UserId", 107 | column: x => x.UserId, 108 | principalTable: "AspNetUsers", 109 | principalColumn: "Id", 110 | onDelete: ReferentialAction.Cascade); 111 | }); 112 | 113 | migrationBuilder.CreateTable( 114 | name: "AspNetUserRoles", 115 | columns: table => new 116 | { 117 | UserId = table.Column(type: "nvarchar(450)", nullable: false), 118 | RoleId = table.Column(type: "nvarchar(450)", nullable: false) 119 | }, 120 | constraints: table => 121 | { 122 | table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); 123 | table.ForeignKey( 124 | name: "FK_AspNetUserRoles_AspNetRoles_RoleId", 125 | column: x => x.RoleId, 126 | principalTable: "AspNetRoles", 127 | principalColumn: "Id", 128 | onDelete: ReferentialAction.Cascade); 129 | table.ForeignKey( 130 | name: "FK_AspNetUserRoles_AspNetUsers_UserId", 131 | column: x => x.UserId, 132 | principalTable: "AspNetUsers", 133 | principalColumn: "Id", 134 | onDelete: ReferentialAction.Cascade); 135 | }); 136 | 137 | migrationBuilder.CreateTable( 138 | name: "AspNetUserTokens", 139 | columns: table => new 140 | { 141 | UserId = table.Column(type: "nvarchar(450)", nullable: false), 142 | LoginProvider = table.Column(type: "nvarchar(450)", nullable: false), 143 | Name = table.Column(type: "nvarchar(450)", nullable: false), 144 | Value = table.Column(type: "nvarchar(max)", nullable: true) 145 | }, 146 | constraints: table => 147 | { 148 | table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); 149 | table.ForeignKey( 150 | name: "FK_AspNetUserTokens_AspNetUsers_UserId", 151 | column: x => x.UserId, 152 | principalTable: "AspNetUsers", 153 | principalColumn: "Id", 154 | onDelete: ReferentialAction.Cascade); 155 | }); 156 | 157 | migrationBuilder.CreateIndex( 158 | name: "IX_AspNetRoleClaims_RoleId", 159 | table: "AspNetRoleClaims", 160 | column: "RoleId"); 161 | 162 | migrationBuilder.CreateIndex( 163 | name: "RoleNameIndex", 164 | table: "AspNetRoles", 165 | column: "NormalizedName", 166 | unique: true, 167 | filter: "[NormalizedName] IS NOT NULL"); 168 | 169 | migrationBuilder.CreateIndex( 170 | name: "IX_AspNetUserClaims_UserId", 171 | table: "AspNetUserClaims", 172 | column: "UserId"); 173 | 174 | migrationBuilder.CreateIndex( 175 | name: "IX_AspNetUserLogins_UserId", 176 | table: "AspNetUserLogins", 177 | column: "UserId"); 178 | 179 | migrationBuilder.CreateIndex( 180 | name: "IX_AspNetUserRoles_RoleId", 181 | table: "AspNetUserRoles", 182 | column: "RoleId"); 183 | 184 | migrationBuilder.CreateIndex( 185 | name: "EmailIndex", 186 | table: "AspNetUsers", 187 | column: "NormalizedEmail"); 188 | 189 | migrationBuilder.CreateIndex( 190 | name: "UserNameIndex", 191 | table: "AspNetUsers", 192 | column: "NormalizedUserName", 193 | unique: true, 194 | filter: "[NormalizedUserName] IS NOT NULL"); 195 | } 196 | 197 | protected override void Down(MigrationBuilder migrationBuilder) 198 | { 199 | migrationBuilder.DropTable( 200 | name: "AspNetRoleClaims"); 201 | 202 | migrationBuilder.DropTable( 203 | name: "AspNetUserClaims"); 204 | 205 | migrationBuilder.DropTable( 206 | name: "AspNetUserLogins"); 207 | 208 | migrationBuilder.DropTable( 209 | name: "AspNetUserRoles"); 210 | 211 | migrationBuilder.DropTable( 212 | name: "AspNetUserTokens"); 213 | 214 | migrationBuilder.DropTable( 215 | name: "AspNetRoles"); 216 | 217 | migrationBuilder.DropTable( 218 | name: "AspNetUsers"); 219 | } 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Migrations/BookStoreContextModelSnapshot.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using BookStore.API.Data; 4 | using Microsoft.EntityFrameworkCore; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | using Microsoft.EntityFrameworkCore.Metadata; 7 | using Microsoft.EntityFrameworkCore.Storage.ValueConversion; 8 | 9 | namespace BookStore.API.Migrations 10 | { 11 | [DbContext(typeof(BookStoreContext))] 12 | partial class BookStoreContextModelSnapshot : ModelSnapshot 13 | { 14 | protected override void BuildModel(ModelBuilder modelBuilder) 15 | { 16 | #pragma warning disable 612, 618 17 | modelBuilder 18 | .HasAnnotation("Relational:MaxIdentifierLength", 128) 19 | .HasAnnotation("ProductVersion", "5.0.4") 20 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 21 | 22 | modelBuilder.Entity("BookStore.API.Data.Books", b => 23 | { 24 | b.Property("Id") 25 | .ValueGeneratedOnAdd() 26 | .HasColumnType("int") 27 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 28 | 29 | b.Property("Description") 30 | .HasColumnType("nvarchar(max)"); 31 | 32 | b.Property("Title") 33 | .HasColumnType("nvarchar(max)"); 34 | 35 | b.HasKey("Id"); 36 | 37 | b.ToTable("Books"); 38 | }); 39 | 40 | modelBuilder.Entity("BookStore.API.Models.ApplicationUser", b => 41 | { 42 | b.Property("Id") 43 | .HasColumnType("nvarchar(450)"); 44 | 45 | b.Property("AccessFailedCount") 46 | .HasColumnType("int"); 47 | 48 | b.Property("ConcurrencyStamp") 49 | .IsConcurrencyToken() 50 | .HasColumnType("nvarchar(max)"); 51 | 52 | b.Property("Email") 53 | .HasMaxLength(256) 54 | .HasColumnType("nvarchar(256)"); 55 | 56 | b.Property("EmailConfirmed") 57 | .HasColumnType("bit"); 58 | 59 | b.Property("FirstName") 60 | .HasColumnType("nvarchar(max)"); 61 | 62 | b.Property("LastName") 63 | .HasColumnType("nvarchar(max)"); 64 | 65 | b.Property("LockoutEnabled") 66 | .HasColumnType("bit"); 67 | 68 | b.Property("LockoutEnd") 69 | .HasColumnType("datetimeoffset"); 70 | 71 | b.Property("NormalizedEmail") 72 | .HasMaxLength(256) 73 | .HasColumnType("nvarchar(256)"); 74 | 75 | b.Property("NormalizedUserName") 76 | .HasMaxLength(256) 77 | .HasColumnType("nvarchar(256)"); 78 | 79 | b.Property("PasswordHash") 80 | .HasColumnType("nvarchar(max)"); 81 | 82 | b.Property("PhoneNumber") 83 | .HasColumnType("nvarchar(max)"); 84 | 85 | b.Property("PhoneNumberConfirmed") 86 | .HasColumnType("bit"); 87 | 88 | b.Property("SecurityStamp") 89 | .HasColumnType("nvarchar(max)"); 90 | 91 | b.Property("TwoFactorEnabled") 92 | .HasColumnType("bit"); 93 | 94 | b.Property("UserName") 95 | .HasMaxLength(256) 96 | .HasColumnType("nvarchar(256)"); 97 | 98 | b.HasKey("Id"); 99 | 100 | b.HasIndex("NormalizedEmail") 101 | .HasDatabaseName("EmailIndex"); 102 | 103 | b.HasIndex("NormalizedUserName") 104 | .IsUnique() 105 | .HasDatabaseName("UserNameIndex") 106 | .HasFilter("[NormalizedUserName] IS NOT NULL"); 107 | 108 | b.ToTable("AspNetUsers"); 109 | }); 110 | 111 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => 112 | { 113 | b.Property("Id") 114 | .HasColumnType("nvarchar(450)"); 115 | 116 | b.Property("ConcurrencyStamp") 117 | .IsConcurrencyToken() 118 | .HasColumnType("nvarchar(max)"); 119 | 120 | b.Property("Name") 121 | .HasMaxLength(256) 122 | .HasColumnType("nvarchar(256)"); 123 | 124 | b.Property("NormalizedName") 125 | .HasMaxLength(256) 126 | .HasColumnType("nvarchar(256)"); 127 | 128 | b.HasKey("Id"); 129 | 130 | b.HasIndex("NormalizedName") 131 | .IsUnique() 132 | .HasDatabaseName("RoleNameIndex") 133 | .HasFilter("[NormalizedName] IS NOT NULL"); 134 | 135 | b.ToTable("AspNetRoles"); 136 | }); 137 | 138 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 139 | { 140 | b.Property("Id") 141 | .ValueGeneratedOnAdd() 142 | .HasColumnType("int") 143 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 144 | 145 | b.Property("ClaimType") 146 | .HasColumnType("nvarchar(max)"); 147 | 148 | b.Property("ClaimValue") 149 | .HasColumnType("nvarchar(max)"); 150 | 151 | b.Property("RoleId") 152 | .IsRequired() 153 | .HasColumnType("nvarchar(450)"); 154 | 155 | b.HasKey("Id"); 156 | 157 | b.HasIndex("RoleId"); 158 | 159 | b.ToTable("AspNetRoleClaims"); 160 | }); 161 | 162 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 163 | { 164 | b.Property("Id") 165 | .ValueGeneratedOnAdd() 166 | .HasColumnType("int") 167 | .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); 168 | 169 | b.Property("ClaimType") 170 | .HasColumnType("nvarchar(max)"); 171 | 172 | b.Property("ClaimValue") 173 | .HasColumnType("nvarchar(max)"); 174 | 175 | b.Property("UserId") 176 | .IsRequired() 177 | .HasColumnType("nvarchar(450)"); 178 | 179 | b.HasKey("Id"); 180 | 181 | b.HasIndex("UserId"); 182 | 183 | b.ToTable("AspNetUserClaims"); 184 | }); 185 | 186 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 187 | { 188 | b.Property("LoginProvider") 189 | .HasColumnType("nvarchar(450)"); 190 | 191 | b.Property("ProviderKey") 192 | .HasColumnType("nvarchar(450)"); 193 | 194 | b.Property("ProviderDisplayName") 195 | .HasColumnType("nvarchar(max)"); 196 | 197 | b.Property("UserId") 198 | .IsRequired() 199 | .HasColumnType("nvarchar(450)"); 200 | 201 | b.HasKey("LoginProvider", "ProviderKey"); 202 | 203 | b.HasIndex("UserId"); 204 | 205 | b.ToTable("AspNetUserLogins"); 206 | }); 207 | 208 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 209 | { 210 | b.Property("UserId") 211 | .HasColumnType("nvarchar(450)"); 212 | 213 | b.Property("RoleId") 214 | .HasColumnType("nvarchar(450)"); 215 | 216 | b.HasKey("UserId", "RoleId"); 217 | 218 | b.HasIndex("RoleId"); 219 | 220 | b.ToTable("AspNetUserRoles"); 221 | }); 222 | 223 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 224 | { 225 | b.Property("UserId") 226 | .HasColumnType("nvarchar(450)"); 227 | 228 | b.Property("LoginProvider") 229 | .HasColumnType("nvarchar(450)"); 230 | 231 | b.Property("Name") 232 | .HasColumnType("nvarchar(450)"); 233 | 234 | b.Property("Value") 235 | .HasColumnType("nvarchar(max)"); 236 | 237 | b.HasKey("UserId", "LoginProvider", "Name"); 238 | 239 | b.ToTable("AspNetUserTokens"); 240 | }); 241 | 242 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => 243 | { 244 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) 245 | .WithMany() 246 | .HasForeignKey("RoleId") 247 | .OnDelete(DeleteBehavior.Cascade) 248 | .IsRequired(); 249 | }); 250 | 251 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => 252 | { 253 | b.HasOne("BookStore.API.Models.ApplicationUser", null) 254 | .WithMany() 255 | .HasForeignKey("UserId") 256 | .OnDelete(DeleteBehavior.Cascade) 257 | .IsRequired(); 258 | }); 259 | 260 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => 261 | { 262 | b.HasOne("BookStore.API.Models.ApplicationUser", null) 263 | .WithMany() 264 | .HasForeignKey("UserId") 265 | .OnDelete(DeleteBehavior.Cascade) 266 | .IsRequired(); 267 | }); 268 | 269 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => 270 | { 271 | b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) 272 | .WithMany() 273 | .HasForeignKey("RoleId") 274 | .OnDelete(DeleteBehavior.Cascade) 275 | .IsRequired(); 276 | 277 | b.HasOne("BookStore.API.Models.ApplicationUser", null) 278 | .WithMany() 279 | .HasForeignKey("UserId") 280 | .OnDelete(DeleteBehavior.Cascade) 281 | .IsRequired(); 282 | }); 283 | 284 | modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => 285 | { 286 | b.HasOne("BookStore.API.Models.ApplicationUser", null) 287 | .WithMany() 288 | .HasForeignKey("UserId") 289 | .OnDelete(DeleteBehavior.Cascade) 290 | .IsRequired(); 291 | }); 292 | #pragma warning restore 612, 618 293 | } 294 | } 295 | } 296 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Models/ApplicationUser.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Identity; 2 | 3 | namespace BookStore.API.Models 4 | { 5 | public class ApplicationUser : IdentityUser 6 | { 7 | public string FirstName { get; set; } 8 | public string LastName { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Models/BookModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace BookStore.API.Models 8 | { 9 | public class BookModel 10 | { 11 | public int Id { get; set; } 12 | 13 | [Required(ErrorMessage ="Please Add title property")] 14 | 15 | public string Title { get; set; } 16 | public string Description { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Models/SignInModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace BookStore.API.Models 8 | { 9 | public class SignInModel 10 | { 11 | [Required, EmailAddress] 12 | public string Email { get; set; } 13 | [Required] 14 | public string Password { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Models/SignUpModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace BookStore.API.Models 8 | { 9 | public class SignUpModel 10 | { 11 | [Required] 12 | public string FirstName { get; set; } 13 | 14 | [Required] 15 | public string LastName { get; set; } 16 | 17 | [Required] 18 | [EmailAddress] 19 | public string Email { get; set; } 20 | 21 | [Required] 22 | [Compare("ConfirmPassword")] 23 | public string Password { get; set; } 24 | 25 | [Required] 26 | public string ConfirmPassword { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Configuration; 3 | using Microsoft.Extensions.Hosting; 4 | using Microsoft.Extensions.Logging; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace BookStore.API 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:60427", 8 | "sslPort": 44341 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "weatherforecast", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "BookStore.API": { 21 | "commandName": "Project", 22 | "dotnetRunMessages": "true", 23 | "launchBrowser": true, 24 | "launchUrl": "weatherforecast", 25 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 26 | "environmentVariables": { 27 | "ASPNETCORE_ENVIRONMENT": "Development" 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Repository/AccountRepository.cs: -------------------------------------------------------------------------------- 1 | using BookStore.API.Models; 2 | using Microsoft.AspNetCore.Identity; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.IdentityModel.Tokens; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.IdentityModel.Tokens.Jwt; 8 | using System.Linq; 9 | using System.Security.Claims; 10 | using System.Text; 11 | using System.Threading.Tasks; 12 | 13 | namespace BookStore.API.Repository 14 | { 15 | public class AccountRepository : IAccountRepository 16 | { 17 | private readonly UserManager _userManager; 18 | private readonly SignInManager _signInManager; 19 | private readonly IConfiguration _configuration; 20 | 21 | public AccountRepository(UserManager userManager, 22 | SignInManager signInManager, 23 | IConfiguration configuration) 24 | { 25 | _userManager = userManager; 26 | _signInManager = signInManager; 27 | _configuration = configuration; 28 | } 29 | 30 | public async Task SignUpAsync(SignUpModel signUpModel) 31 | { 32 | var user = new ApplicationUser() 33 | { 34 | FirstName = signUpModel.FirstName, 35 | LastName = signUpModel.LastName, 36 | Email = signUpModel.Email, 37 | UserName = signUpModel.Email 38 | }; 39 | 40 | return await _userManager.CreateAsync(user, signUpModel.Password); 41 | } 42 | 43 | public async Task LoginAsync(SignInModel signInModel) 44 | { 45 | var result = await _signInManager.PasswordSignInAsync(signInModel.Email, signInModel.Password, false, false); 46 | 47 | if (!result.Succeeded) 48 | { 49 | return null; 50 | } 51 | 52 | var authClaims = new List 53 | { 54 | new Claim(ClaimTypes.Name, signInModel.Email), 55 | new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()) 56 | }; 57 | var authSigninKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(_configuration["JWT:Secret"])); 58 | 59 | var token = new JwtSecurityToken( 60 | issuer: _configuration["JWT:ValidIssuer"], 61 | audience: _configuration["JWT:ValidAudience"], 62 | expires: DateTime.Now.AddDays(1), 63 | claims: authClaims, 64 | signingCredentials: new SigningCredentials(authSigninKey, SecurityAlgorithms.HmacSha256Signature) 65 | ); 66 | 67 | return new JwtSecurityTokenHandler().WriteToken(token); 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Repository/BookRepository.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using BookStore.API.Data; 3 | using BookStore.API.Models; 4 | using Microsoft.AspNetCore.JsonPatch; 5 | using Microsoft.EntityFrameworkCore; 6 | using System; 7 | using System.Collections.Generic; 8 | using System.Linq; 9 | using System.Threading.Tasks; 10 | 11 | namespace BookStore.API.Repository 12 | { 13 | public class BookRepository : IBookRepository 14 | { 15 | private readonly BookStoreContext _context; 16 | private readonly IMapper _mapper; 17 | 18 | public BookRepository(BookStoreContext context, IMapper mapper) 19 | { 20 | _context = context; 21 | _mapper = mapper; 22 | } 23 | 24 | public async Task> GetAllBooksAsync() 25 | { 26 | var records = await _context.Books.ToListAsync(); 27 | return _mapper.Map>(records); 28 | } 29 | 30 | public async Task GetBookByIdAsync(int bookId) 31 | { 32 | //var records = await _context.Books.Where(x => x.Id == bookId).Select(x => new BookModel() 33 | //{ 34 | // Id = x.Id, 35 | // Title = x.Title, 36 | // Description = x.Description 37 | //}).FirstOrDefaultAsync(); 38 | 39 | //return records; 40 | 41 | var book = await _context.Books.FindAsync(bookId); 42 | return _mapper.Map(book); 43 | } 44 | 45 | public async Task AddBookAsync(BookModel bookModel) 46 | { 47 | var book = new Books() 48 | { 49 | Title = bookModel.Title, 50 | Description = bookModel.Description 51 | }; 52 | 53 | _context.Books.Add(book); 54 | await _context.SaveChangesAsync(); 55 | 56 | return book.Id; 57 | } 58 | 59 | public async Task UpdateBookAsync(int bookId, BookModel bookModel) 60 | { 61 | //var book = await _context.Books.FindAsync(bookId); 62 | //if (book != null) 63 | //{ 64 | // book.Title = bookModel.Title; 65 | // book.Description = bookModel.Description; 66 | 67 | // await _context.SaveChangesAsync(); 68 | //} 69 | 70 | var book = new Books() 71 | { 72 | Id = bookId, 73 | Title = bookModel.Title, 74 | Description = bookModel.Description 75 | }; 76 | 77 | _context.Books.Update(book); 78 | await _context.SaveChangesAsync(); 79 | } 80 | 81 | public async Task UpdateBookPatchAsync(int bookId, JsonPatchDocument bookModel) 82 | { 83 | var book = await _context.Books.FindAsync(bookId); 84 | if (book != null) 85 | { 86 | bookModel.ApplyTo(book); 87 | await _context.SaveChangesAsync(); 88 | } 89 | } 90 | 91 | public async Task DeleteBookAsync(int bookId) 92 | { 93 | var book = new Books() { Id = bookId }; 94 | 95 | _context.Books.Remove(book); 96 | 97 | await _context.SaveChangesAsync(); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Repository/IAccountRepository.cs: -------------------------------------------------------------------------------- 1 | using BookStore.API.Models; 2 | using Microsoft.AspNetCore.Identity; 3 | using System.Threading.Tasks; 4 | 5 | namespace BookStore.API.Repository 6 | { 7 | public interface IAccountRepository 8 | { 9 | Task SignUpAsync(SignUpModel signUpModel); 10 | Task LoginAsync(SignInModel signInModel); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Repository/IBookRepository.cs: -------------------------------------------------------------------------------- 1 | using BookStore.API.Models; 2 | using Microsoft.AspNetCore.JsonPatch; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace BookStore.API.Repository 7 | { 8 | public interface IBookRepository 9 | { 10 | Task> GetAllBooksAsync(); 11 | Task GetBookByIdAsync(int bookId); 12 | Task AddBookAsync(BookModel bookModel); 13 | Task UpdateBookAsync(int bookId, BookModel bookModel); 14 | Task UpdateBookPatchAsync(int bookId, JsonPatchDocument bookModel); 15 | Task DeleteBookAsync(int bookId); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/Startup.cs: -------------------------------------------------------------------------------- 1 | using BookStore.API.Data; 2 | using BookStore.API.Models; 3 | using BookStore.API.Repository; 4 | using Microsoft.AspNetCore.Authentication.JwtBearer; 5 | using Microsoft.AspNetCore.Builder; 6 | using Microsoft.AspNetCore.Hosting; 7 | using Microsoft.AspNetCore.HttpsPolicy; 8 | using Microsoft.AspNetCore.Identity; 9 | using Microsoft.AspNetCore.Mvc; 10 | using Microsoft.EntityFrameworkCore; 11 | using Microsoft.Extensions.Configuration; 12 | using Microsoft.Extensions.DependencyInjection; 13 | using Microsoft.Extensions.Hosting; 14 | using Microsoft.Extensions.Logging; 15 | using Microsoft.IdentityModel.Tokens; 16 | using System; 17 | using System.Collections.Generic; 18 | using System.Linq; 19 | using System.Text; 20 | using System.Threading.Tasks; 21 | 22 | namespace BookStore.API 23 | { 24 | public class Startup 25 | { 26 | public Startup(IConfiguration configuration) 27 | { 28 | Configuration = configuration; 29 | } 30 | 31 | public IConfiguration Configuration { get; } 32 | 33 | // This method gets called by the runtime. Use this method to add services to the container. 34 | public void ConfigureServices(IServiceCollection services) 35 | { 36 | services.AddDbContext( 37 | options => options.UseSqlServer(Configuration.GetConnectionString("BookStoreDB"))); 38 | 39 | 40 | services.AddIdentity() 41 | .AddEntityFrameworkStores() 42 | .AddDefaultTokenProviders(); 43 | 44 | services.AddAuthentication(option => 45 | { 46 | option.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; 47 | option.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; 48 | option.DefaultScheme = JwtBearerDefaults.AuthenticationScheme; 49 | }) 50 | .AddJwtBearer(option => 51 | { 52 | option.SaveToken = true; 53 | option.RequireHttpsMetadata = false; 54 | option.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters() 55 | { 56 | ValidateIssuer = true, 57 | ValidateAudience = true, 58 | ValidAudience = Configuration["JWT:ValidAudience"], 59 | ValidIssuer = Configuration["JWT:ValidIssuer"], 60 | IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["JWT:Secret"])) 61 | }; 62 | }); 63 | 64 | services.AddControllers().AddNewtonsoftJson(); 65 | services.AddTransient(); 66 | services.AddTransient(); 67 | services.AddAutoMapper(typeof(Startup)); 68 | 69 | services.AddCors(option => 70 | { 71 | option.AddDefaultPolicy(builder => 72 | { 73 | builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod(); 74 | }); 75 | }); 76 | } 77 | 78 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 79 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 80 | { 81 | if (env.IsDevelopment()) 82 | { 83 | app.UseDeveloperExceptionPage(); 84 | } 85 | 86 | app.UseHttpsRedirection(); 87 | 88 | app.UseRouting(); 89 | app.UseCors(); 90 | 91 | app.UseAuthentication(); 92 | app.UseAuthorization(); 93 | 94 | app.UseEndpoints(endpoints => 95 | { 96 | endpoints.MapControllers(); 97 | }); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace BookStore.API 4 | { 5 | public class WeatherForecast 6 | { 7 | public DateTime Date { get; set; } 8 | 9 | public int TemperatureC { get; set; } 10 | 11 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 12 | 13 | public string Summary { get; set; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "ConnectionStrings": { 10 | "BookStoreDB": "Server=.;Database=BoosStoreAPI;Integrated Security=True" 11 | }, 12 | "AllowedHosts": "*", 13 | "JWT": { 14 | "ValidAudience": "User", 15 | "ValidIssuer": "https://localhost:44341", 16 | "Secret": "ThisIsMySecureKey12345678" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /BookStore/BookStore.API/BookStore.API/libman.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "defaultProvider": "cdnjs", 4 | "libraries": [] 5 | } -------------------------------------------------------------------------------- /BookStoreWebApp/.browserslistrc: -------------------------------------------------------------------------------- 1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below. 2 | # For additional information regarding the format and rule options, please see: 3 | # https://github.com/browserslist/browserslist#queries 4 | 5 | # For the full list of supported browsers by the Angular framework, please see: 6 | # https://angular.io/guide/browser-support 7 | 8 | # You can see what browsers were selected by your queries by running: 9 | # npx browserslist 10 | 11 | last 1 Chrome version 12 | last 1 Firefox version 13 | last 2 Edge major versions 14 | last 2 Safari major versions 15 | last 2 iOS major versions 16 | Firefox ESR 17 | not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line. 18 | not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line. 19 | -------------------------------------------------------------------------------- /BookStoreWebApp/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /BookStoreWebApp/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | -------------------------------------------------------------------------------- /BookStoreWebApp/README.md: -------------------------------------------------------------------------------- 1 | # BookStoreWebApp 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.1.4. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 28 | -------------------------------------------------------------------------------- /BookStoreWebApp/angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "BookStoreWebApp": { 7 | "projectType": "application", 8 | "schematics": { 9 | "@schematics/angular:component": { 10 | "style": "scss" 11 | } 12 | }, 13 | "root": "", 14 | "sourceRoot": "src", 15 | "prefix": "app", 16 | "architect": { 17 | "build": { 18 | "builder": "@angular-devkit/build-angular:browser", 19 | "options": { 20 | "outputPath": "dist/BookStoreWebApp", 21 | "index": "src/index.html", 22 | "main": "src/main.ts", 23 | "polyfills": "src/polyfills.ts", 24 | "tsConfig": "tsconfig.app.json", 25 | "aot": true, 26 | "assets": [ 27 | "src/favicon.ico", 28 | "src/assets" 29 | ], 30 | "styles": [ 31 | "src/styles.scss", 32 | "./node_modules/bootstrap/dist/css/bootstrap.css" 33 | ], 34 | "scripts": [] 35 | }, 36 | "configurations": { 37 | "production": { 38 | "fileReplacements": [ 39 | { 40 | "replace": "src/environments/environment.ts", 41 | "with": "src/environments/environment.prod.ts" 42 | } 43 | ], 44 | "optimization": true, 45 | "outputHashing": "all", 46 | "sourceMap": false, 47 | "extractCss": true, 48 | "namedChunks": false, 49 | "extractLicenses": true, 50 | "vendorChunk": false, 51 | "buildOptimizer": true, 52 | "budgets": [ 53 | { 54 | "type": "initial", 55 | "maximumWarning": "2mb", 56 | "maximumError": "5mb" 57 | }, 58 | { 59 | "type": "anyComponentStyle", 60 | "maximumWarning": "6kb", 61 | "maximumError": "10kb" 62 | } 63 | ] 64 | } 65 | } 66 | }, 67 | "serve": { 68 | "builder": "@angular-devkit/build-angular:dev-server", 69 | "options": { 70 | "browserTarget": "BookStoreWebApp:build" 71 | }, 72 | "configurations": { 73 | "production": { 74 | "browserTarget": "BookStoreWebApp:build:production" 75 | } 76 | } 77 | }, 78 | "extract-i18n": { 79 | "builder": "@angular-devkit/build-angular:extract-i18n", 80 | "options": { 81 | "browserTarget": "BookStoreWebApp:build" 82 | } 83 | }, 84 | "test": { 85 | "builder": "@angular-devkit/build-angular:karma", 86 | "options": { 87 | "main": "src/test.ts", 88 | "polyfills": "src/polyfills.ts", 89 | "tsConfig": "tsconfig.spec.json", 90 | "karmaConfig": "karma.conf.js", 91 | "assets": [ 92 | "src/favicon.ico", 93 | "src/assets" 94 | ], 95 | "styles": [ 96 | "src/styles.scss" 97 | ], 98 | "scripts": [] 99 | } 100 | }, 101 | "lint": { 102 | "builder": "@angular-devkit/build-angular:tslint", 103 | "options": { 104 | "tsConfig": [ 105 | "tsconfig.app.json", 106 | "tsconfig.spec.json", 107 | "e2e/tsconfig.json" 108 | ], 109 | "exclude": [ 110 | "**/node_modules/**" 111 | ] 112 | } 113 | }, 114 | "e2e": { 115 | "builder": "@angular-devkit/build-angular:protractor", 116 | "options": { 117 | "protractorConfig": "e2e/protractor.conf.js", 118 | "devServerTarget": "BookStoreWebApp:serve" 119 | }, 120 | "configurations": { 121 | "production": { 122 | "devServerTarget": "BookStoreWebApp:serve:production" 123 | } 124 | } 125 | } 126 | } 127 | } 128 | }, 129 | "defaultProject": "BookStoreWebApp" 130 | } -------------------------------------------------------------------------------- /BookStoreWebApp/e2e/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | // Protractor configuration file, see link for more information 3 | // https://github.com/angular/protractor/blob/master/lib/config.ts 4 | 5 | const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter'); 6 | 7 | /** 8 | * @type { import("protractor").Config } 9 | */ 10 | exports.config = { 11 | allScriptsTimeout: 11000, 12 | specs: [ 13 | './src/**/*.e2e-spec.ts' 14 | ], 15 | capabilities: { 16 | browserName: 'chrome' 17 | }, 18 | directConnect: true, 19 | baseUrl: 'http://localhost:4200/', 20 | framework: 'jasmine', 21 | jasmineNodeOpts: { 22 | showColors: true, 23 | defaultTimeoutInterval: 30000, 24 | print: function() {} 25 | }, 26 | onPrepare() { 27 | require('ts-node').register({ 28 | project: require('path').join(__dirname, './tsconfig.json') 29 | }); 30 | jasmine.getEnv().addReporter(new SpecReporter({ 31 | spec: { 32 | displayStacktrace: StacktraceOption.PRETTY 33 | } 34 | })); 35 | } 36 | }; -------------------------------------------------------------------------------- /BookStoreWebApp/e2e/src/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | import { browser, logging } from 'protractor'; 3 | 4 | describe('workspace-project App', () => { 5 | let page: AppPage; 6 | 7 | beforeEach(() => { 8 | page = new AppPage(); 9 | }); 10 | 11 | it('should display welcome message', () => { 12 | page.navigateTo(); 13 | expect(page.getTitleText()).toEqual('BookStoreWebApp app is running!'); 14 | }); 15 | 16 | afterEach(async () => { 17 | // Assert that there are no errors emitted from the browser 18 | const logs = await browser.manage().logs().get(logging.Type.BROWSER); 19 | expect(logs).not.toContain(jasmine.objectContaining({ 20 | level: logging.Level.SEVERE, 21 | } as logging.Entry)); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /BookStoreWebApp/e2e/src/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo(): Promise { 5 | return browser.get(browser.baseUrl) as Promise; 6 | } 7 | 8 | getTitleText(): Promise { 9 | return element(by.css('app-root .content span')).getText() as Promise; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /BookStoreWebApp/e2e/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "../tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "../out-tsc/e2e", 6 | "module": "commonjs", 7 | "target": "es2018", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /BookStoreWebApp/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, './coverage/BookStoreWebApp'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /BookStoreWebApp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "book-store-web-app", 3 | "version": "0.0.0", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "~10.1.4", 15 | "@angular/common": "~10.1.4", 16 | "@angular/compiler": "~10.1.4", 17 | "@angular/core": "~10.1.4", 18 | "@angular/forms": "~10.1.4", 19 | "@angular/platform-browser": "~10.1.4", 20 | "@angular/platform-browser-dynamic": "~10.1.4", 21 | "@angular/router": "~10.1.4", 22 | "bootstrap": "^4.6.0", 23 | "rxjs": "~6.6.0", 24 | "tslib": "^2.0.0", 25 | "zone.js": "~0.10.2" 26 | }, 27 | "devDependencies": { 28 | "@angular-devkit/build-angular": "~0.1001.4", 29 | "@angular/cli": "~10.1.4", 30 | "@angular/compiler-cli": "~10.1.4", 31 | "@types/node": "^12.11.1", 32 | "@types/jasmine": "~3.5.0", 33 | "@types/jasminewd2": "~2.0.3", 34 | "codelyzer": "^6.0.0", 35 | "jasmine-core": "~3.6.0", 36 | "jasmine-spec-reporter": "~5.0.0", 37 | "karma": "~5.0.0", 38 | "karma-chrome-launcher": "~3.1.0", 39 | "karma-coverage-istanbul-reporter": "~3.0.2", 40 | "karma-jasmine": "~4.0.0", 41 | "karma-jasmine-html-reporter": "^1.5.0", 42 | "protractor": "~7.0.0", 43 | "ts-node": "~8.3.0", 44 | "tslint": "~6.1.0", 45 | "typescript": "~4.0.2" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/add-book/add-book.component.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 |
6 |
7 | 8 | 9 |
10 |
11 | 12 |
13 |
-------------------------------------------------------------------------------- /BookStoreWebApp/src/app/add-book/add-book.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/BookStoreWebApp/src/app/add-book/add-book.component.scss -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/add-book/add-book.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AddBookComponent } from './add-book.component'; 4 | 5 | describe('AddBookComponent', () => { 6 | let component: AddBookComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ AddBookComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AddBookComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/add-book/add-book.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { FormBuilder, FormGroup } from '@angular/forms'; 3 | import { BookService } from '../book.service'; 4 | 5 | @Component({ 6 | selector: 'app-add-book', 7 | templateUrl: './add-book.component.html', 8 | styleUrls: ['./add-book.component.scss'] 9 | }) 10 | export class AddBookComponent implements OnInit { 11 | 12 | public bookForm: FormGroup; 13 | 14 | constructor(private formBuilder: FormBuilder, private service: BookService) { } 15 | 16 | ngOnInit(): void { 17 | this.init(); 18 | } 19 | 20 | public saveBook(): void { 21 | this.service.addBook(this.bookForm.value).subscribe(result => { 22 | alert(`New book added with id = ${result}`); 23 | }); 24 | } 25 | 26 | private init(): void { 27 | this.bookForm = this.formBuilder.group({ 28 | title: [], 29 | description: [] 30 | }); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/all-books/all-books.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
IdTitleDescription
{{book.id}}{{book.title}}{{book.description}}
-------------------------------------------------------------------------------- /BookStoreWebApp/src/app/all-books/all-books.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/BookStoreWebApp/src/app/all-books/all-books.component.scss -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/all-books/all-books.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { AllBooksComponent } from './all-books.component'; 4 | 5 | describe('AllBooksComponent', () => { 6 | let component: AllBooksComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async () => { 10 | await TestBed.configureTestingModule({ 11 | declarations: [ AllBooksComponent ] 12 | }) 13 | .compileComponents(); 14 | }); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(AllBooksComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/all-books/all-books.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { BookService } from '../book.service'; 3 | 4 | @Component({ 5 | selector: 'app-all-books', 6 | templateUrl: './all-books.component.html', 7 | styleUrls: ['./all-books.component.scss'] 8 | }) 9 | export class AllBooksComponent implements OnInit { 10 | 11 | public books: any; 12 | constructor(private service: BookService) { } 13 | 14 | ngOnInit(): void { 15 | this.getBooks(); 16 | } 17 | 18 | private getBooks(): void { 19 | this.service.getBooks().subscribe(result => { 20 | this.books = result; 21 | }); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/app-routing.module.ts: -------------------------------------------------------------------------------- 1 | import { NgModule } from '@angular/core'; 2 | import { RouterModule, Routes } from '@angular/router'; 3 | import { AddBookComponent } from './add-book/add-book.component'; 4 | import { AllBooksComponent } from './all-books/all-books.component'; 5 | 6 | const routes: Routes = [ 7 | { path: 'books', component: AllBooksComponent }, 8 | { path: 'add', component: AddBookComponent } 9 | ]; 10 | 11 | @NgModule({ 12 | imports: [RouterModule.forRoot(routes)], 13 | exports: [RouterModule] 14 | }) 15 | export class AppRoutingModule { } 16 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/app.component.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/app.component.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/BookStoreWebApp/src/app/app.component.scss -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | import { RouterTestingModule } from '@angular/router/testing'; 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async () => { 7 | await TestBed.configureTestingModule({ 8 | imports: [ 9 | RouterTestingModule 10 | ], 11 | declarations: [ 12 | AppComponent 13 | ], 14 | }).compileComponents(); 15 | }); 16 | 17 | it('should create the app', () => { 18 | const fixture = TestBed.createComponent(AppComponent); 19 | const app = fixture.componentInstance; 20 | expect(app).toBeTruthy(); 21 | }); 22 | 23 | it(`should have as title 'BookStoreWebApp'`, () => { 24 | const fixture = TestBed.createComponent(AppComponent); 25 | const app = fixture.componentInstance; 26 | expect(app.title).toEqual('BookStoreWebApp'); 27 | }); 28 | 29 | it('should render title', () => { 30 | const fixture = TestBed.createComponent(AppComponent); 31 | fixture.detectChanges(); 32 | const compiled = fixture.nativeElement; 33 | expect(compiled.querySelector('.content span').textContent).toContain('BookStoreWebApp app is running!'); 34 | }); 35 | }); 36 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'app-root', 5 | templateUrl: './app.component.html', 6 | styleUrls: ['./app.component.scss'] 7 | }) 8 | export class AppComponent { 9 | title = 'BookStoreWebApp'; 10 | } 11 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { HttpClientModule } from '@angular/common/http'; 2 | import { NgModule } from '@angular/core'; 3 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; 4 | import { BrowserModule } from '@angular/platform-browser'; 5 | import { AddBookComponent } from './add-book/add-book.component'; 6 | import { AllBooksComponent } from './all-books/all-books.component'; 7 | import { AppRoutingModule } from './app-routing.module'; 8 | import { AppComponent } from './app.component'; 9 | 10 | 11 | @NgModule({ 12 | declarations: [ 13 | AppComponent, 14 | AllBooksComponent, 15 | AddBookComponent 16 | ], 17 | imports: [ 18 | BrowserModule, 19 | AppRoutingModule, 20 | HttpClientModule, 21 | FormsModule, 22 | ReactiveFormsModule 23 | ], 24 | providers: [], 25 | bootstrap: [AppComponent] 26 | }) 27 | export class AppModule { } 28 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/book.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { BookService } from './book.service'; 4 | 5 | describe('BookService', () => { 6 | let service: BookService; 7 | 8 | beforeEach(() => { 9 | TestBed.configureTestingModule({}); 10 | service = TestBed.inject(BookService); 11 | }); 12 | 13 | it('should be created', () => { 14 | expect(service).toBeTruthy(); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/app/book.service.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from '@angular/common/http'; 2 | import { Injectable } from '@angular/core'; 3 | import { Observable } from 'rxjs'; 4 | 5 | @Injectable({ 6 | providedIn: 'root' 7 | }) 8 | export class BookService { 9 | 10 | private basePath = 'https://localhost:44341/api/books'; 11 | constructor(private http: HttpClient) { } 12 | 13 | public getBooks(): Observable { 14 | return this.http.get(this.basePath); 15 | } 16 | 17 | public addBook(book: any): Observable { 18 | return this.http.post(this.basePath, book); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/BookStoreWebApp/src/assets/.gitkeep -------------------------------------------------------------------------------- /BookStoreWebApp/src/environments/environment.prod.ts: -------------------------------------------------------------------------------- 1 | export const environment = { 2 | production: true 3 | }; 4 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/environments/environment.ts: -------------------------------------------------------------------------------- 1 | // This file can be replaced during build by using the `fileReplacements` array. 2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. 3 | // The list of file replacements can be found in `angular.json`. 4 | 5 | export const environment = { 6 | production: false 7 | }; 8 | 9 | /* 10 | * For easier debugging in development mode, you can import the following file 11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. 12 | * 13 | * This import should be commented out in production mode because it will have a negative impact 14 | * on performance if an error is thrown. 15 | */ 16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI. 17 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/BookStoreWebApp/src/favicon.ico -------------------------------------------------------------------------------- /BookStoreWebApp/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BookStoreWebApp 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule) 12 | .catch(err => console.error(err)); 13 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/guide/browser-support 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 22 | // import 'classlist.js'; // Run `npm install --save classlist.js`. 23 | 24 | /** 25 | * Web Animations `@angular/platform-browser/animations` 26 | * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. 27 | * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). 28 | */ 29 | // import 'web-animations-js'; // Run `npm install --save web-animations-js`. 30 | 31 | /** 32 | * By default, zone.js will patch all possible macroTask and DomEvents 33 | * user can disable parts of macroTask/DomEvents patch by setting following flags 34 | * because those flags need to be set before `zone.js` being loaded, and webpack 35 | * will put import in the top of bundle, so user need to create a separate file 36 | * in this directory (for example: zone-flags.ts), and put the following flags 37 | * into that file, and then add the following code before importing zone.js. 38 | * import './zone-flags'; 39 | * 40 | * The flags allowed in zone-flags.ts are listed here. 41 | * 42 | * The following flags will work for all browsers. 43 | * 44 | * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame 45 | * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick 46 | * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames 47 | * 48 | * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js 49 | * with the following flag, it will bypass `zone.js` patch for IE/Edge 50 | * 51 | * (window as any).__Zone_enable_cross_context_check = true; 52 | * 53 | */ 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by default for Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | /*************************************************************************************************** 62 | * APPLICATION IMPORTS 63 | */ 64 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/styles.scss: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | -------------------------------------------------------------------------------- /BookStoreWebApp/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone-testing'; 4 | import { getTestBed } from '@angular/core/testing'; 5 | import { 6 | BrowserDynamicTestingModule, 7 | platformBrowserDynamicTesting 8 | } from '@angular/platform-browser-dynamic/testing'; 9 | 10 | declare const require: { 11 | context(path: string, deep?: boolean, filter?: RegExp): { 12 | keys(): string[]; 13 | (id: string): T; 14 | }; 15 | }; 16 | 17 | // First, initialize the Angular testing environment. 18 | getTestBed().initTestEnvironment( 19 | BrowserDynamicTestingModule, 20 | platformBrowserDynamicTesting() 21 | ); 22 | // Then we find all the tests. 23 | const context = require.context('./', true, /\.spec\.ts$/); 24 | // And load the modules. 25 | context.keys().map(context); 26 | -------------------------------------------------------------------------------- /BookStoreWebApp/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": [ 9 | "src/main.ts", 10 | "src/polyfills.ts" 11 | ], 12 | "include": [ 13 | "src/**/*.d.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /BookStoreWebApp/tsconfig.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "compileOnSave": false, 4 | "compilerOptions": { 5 | "baseUrl": "./", 6 | "outDir": "./dist/out-tsc", 7 | "sourceMap": true, 8 | "declaration": false, 9 | "downlevelIteration": true, 10 | "experimentalDecorators": true, 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "module": "es2020", 15 | "lib": [ 16 | "es2018", 17 | "dom" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /BookStoreWebApp/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": [ 7 | "jasmine" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts", 12 | "src/polyfills.ts" 13 | ], 14 | "include": [ 15 | "src/**/*.spec.ts", 16 | "src/**/*.d.ts" 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /BookStoreWebApp/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": [ 4 | "codelyzer" 5 | ], 6 | "rules": { 7 | "align": { 8 | "options": [ 9 | "parameters", 10 | "statements" 11 | ] 12 | }, 13 | "array-type": false, 14 | "arrow-return-shorthand": true, 15 | "curly": true, 16 | "deprecation": { 17 | "severity": "warning" 18 | }, 19 | "eofline": true, 20 | "import-blacklist": [ 21 | true, 22 | "rxjs/Rx" 23 | ], 24 | "import-spacing": true, 25 | "indent": { 26 | "options": [ 27 | "spaces" 28 | ] 29 | }, 30 | "max-classes-per-file": false, 31 | "max-line-length": [ 32 | true, 33 | 140 34 | ], 35 | "member-ordering": [ 36 | true, 37 | { 38 | "order": [ 39 | "static-field", 40 | "instance-field", 41 | "static-method", 42 | "instance-method" 43 | ] 44 | } 45 | ], 46 | "no-console": [ 47 | true, 48 | "debug", 49 | "info", 50 | "time", 51 | "timeEnd", 52 | "trace" 53 | ], 54 | "no-empty": false, 55 | "no-inferrable-types": [ 56 | true, 57 | "ignore-params" 58 | ], 59 | "no-non-null-assertion": true, 60 | "no-redundant-jsdoc": true, 61 | "no-switch-case-fall-through": true, 62 | "no-var-requires": false, 63 | "object-literal-key-quotes": [ 64 | true, 65 | "as-needed" 66 | ], 67 | "quotemark": [ 68 | true, 69 | "single" 70 | ], 71 | "semicolon": { 72 | "options": [ 73 | "always" 74 | ] 75 | }, 76 | "space-before-function-paren": { 77 | "options": { 78 | "anonymous": "never", 79 | "asyncArrow": "always", 80 | "constructor": "never", 81 | "method": "never", 82 | "named": "never" 83 | } 84 | }, 85 | "typedef": [ 86 | true, 87 | "call-signature" 88 | ], 89 | "typedef-whitespace": { 90 | "options": [ 91 | { 92 | "call-signature": "nospace", 93 | "index-signature": "nospace", 94 | "parameter": "nospace", 95 | "property-declaration": "nospace", 96 | "variable-declaration": "nospace" 97 | }, 98 | { 99 | "call-signature": "onespace", 100 | "index-signature": "onespace", 101 | "parameter": "onespace", 102 | "property-declaration": "onespace", 103 | "variable-declaration": "onespace" 104 | } 105 | ] 106 | }, 107 | "variable-name": { 108 | "options": [ 109 | "ban-keywords", 110 | "check-format", 111 | "allow-pascal-case" 112 | ] 113 | }, 114 | "whitespace": { 115 | "options": [ 116 | "check-branch", 117 | "check-decl", 118 | "check-operator", 119 | "check-separator", 120 | "check-type", 121 | "check-typecast" 122 | ] 123 | }, 124 | "component-class-suffix": true, 125 | "contextual-lifecycle": true, 126 | "directive-class-suffix": true, 127 | "no-conflicting-lifecycle": true, 128 | "no-host-metadata-property": true, 129 | "no-input-rename": true, 130 | "no-inputs-metadata-property": true, 131 | "no-output-native": true, 132 | "no-output-on-prefix": true, 133 | "no-output-rename": true, 134 | "no-outputs-metadata-property": true, 135 | "template-banana-in-box": true, 136 | "template-no-negated-async": true, 137 | "use-lifecycle-interface": true, 138 | "use-pipe-transform-interface": true, 139 | "directive-selector": [ 140 | true, 141 | "attribute", 142 | "app", 143 | "camelCase" 144 | ], 145 | "component-selector": [ 146 | true, 147 | "element", 148 | "app", 149 | "kebab-case" 150 | ] 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.30804.86 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleToWebAPI", "ConsoleToWebAPI\ConsoleToWebAPI.csproj", "{FD238561-0BAB-405D-8EAE-F8E79098E7EC}" 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 | {FD238561-0BAB-405D-8EAE-F8E79098E7EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {FD238561-0BAB-405D-8EAE-F8E79098E7EC}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {FD238561-0BAB-405D-8EAE-F8E79098E7EC}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {FD238561-0BAB-405D-8EAE-F8E79098E7EC}.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 = {C1508804-8F3B-4B91-8438-C82C0AADAFEB} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/ConsoleToWebAPI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net5.0 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/ConsoleToWebAPI.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | IIS Express 5 | ApiControllerEmptyScaffolder 6 | root/Common/Api 7 | 8 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Controllers/AnimalsController.cs: -------------------------------------------------------------------------------- 1 | using ConsoleToWebAPI.Models; 2 | using Microsoft.AspNetCore.Http; 3 | using Microsoft.AspNetCore.Mvc; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Threading.Tasks; 8 | 9 | namespace ConsoleToWebAPI.Controllers 10 | { 11 | [Route("api/[controller]")] 12 | [ApiController] 13 | public class AnimalsController : ControllerBase 14 | { 15 | private List animals = null; 16 | public AnimalsController() 17 | { 18 | animals = new List() 19 | { 20 | new AnimalModel() { Id = 1, Name = "Dog" }, 21 | new AnimalModel() { Id = 2, Name = "Lion" } 22 | }; 23 | } 24 | [Route("", Name = "All")] 25 | public IActionResult GetAnimals() 26 | { 27 | return Ok(animals); 28 | } 29 | 30 | [Route("test")] 31 | public IActionResult GetAnimalsTest() 32 | { 33 | return LocalRedirectPermanent("~/api/animals"); 34 | } 35 | 36 | [Route("{name}")] 37 | public IActionResult GetAnimalsByName(string name) 38 | { 39 | if (!name.Contains("ABC")) 40 | { 41 | return BadRequest(); 42 | } 43 | 44 | return Ok(animals); 45 | } 46 | 47 | [Route("{id:int}")] 48 | public IActionResult GetAnimalsById(int id) 49 | { 50 | if (id == 0) 51 | { 52 | return BadRequest(); 53 | } 54 | var animal = animals.FirstOrDefault(x => x.Id == id); 55 | 56 | if (animal == null) 57 | { 58 | return NotFound(); 59 | } 60 | 61 | return Ok(animal); 62 | } 63 | 64 | [HttpPost("")] 65 | public IActionResult GetAnimals(AnimalModel animal) 66 | { 67 | animals.Add(animal); 68 | 69 | return CreatedAtAction("GetAnimalsById", new { id = animal.Id }, animal); 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Controllers/BooksController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | using Microsoft.AspNetCore.Mvc; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleToWebAPI.Controllers 9 | { 10 | [Route("api/[controller]")] 11 | [ApiController] 12 | public class BooksController : ControllerBase 13 | { 14 | [Route("{id:int:min(10):max(100)}")] 15 | public string GetById(int id) 16 | { 17 | return "hello int " + id; 18 | } 19 | 20 | [Route("{id:length(5):alpha}")] 21 | public string GetByIdString(string id) 22 | { 23 | return "hello string " + id; 24 | } 25 | 26 | [Route("{id:regex(a(b|c))}")] 27 | public string GetByIdRegex(string id) 28 | { 29 | return "hello regex " + id; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Controllers/CountriesController.cs: -------------------------------------------------------------------------------- 1 | using ConsoleToWebAPI.Models; 2 | using Microsoft.AspNetCore.Http; 3 | using Microsoft.AspNetCore.Mvc; 4 | using Microsoft.AspNetCore.Mvc.ModelBinding; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleToWebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | // [BindProperties(SupportsGet = true)] 15 | public class CountriesController : ControllerBase 16 | { 17 | //public CountryModel Country { get; set; } 18 | 19 | //public string Name { get; set; } 20 | //public int Population { get; set; } 21 | //public int Area { get; set; } 22 | 23 | 24 | [HttpPost("{id}")] 25 | public IActionResult AddCountry([FromRoute] int id, [FromHeader] string developer, 26 | [FromHeader] string course) 27 | { 28 | return Ok($"Name = {developer}"); 29 | } 30 | 31 | [HttpGet("search")] 32 | public IActionResult SearchCounties([ModelBinder(typeof(CustomBinder))]string[] countries) 33 | { 34 | return Ok(countries); 35 | } 36 | 37 | [HttpGet("{id}")] 38 | public IActionResult CountryDetails([ModelBinder(Name ="Id")]CountryModel country) 39 | { 40 | return Ok(country); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Controllers/EmployeeController.cs: -------------------------------------------------------------------------------- 1 | using ConsoleToWebAPI.Models; 2 | using ConsoleToWebAPI.Repository; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleToWebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class EmployeeController : ControllerBase 15 | { 16 | [Route("")] 17 | public List GetEmployees() 18 | { 19 | return new List() { 20 | new EmployeeModel() { Id = 1, Name = "Employee 1" }, 21 | new EmployeeModel() { Id = 2, Name = "Employee 2"}} 22 | ; 23 | } 24 | 25 | [Route("{id}")] 26 | public IActionResult GetEmployees(int id) 27 | { 28 | if (id == 0) 29 | { 30 | return NotFound(); 31 | } 32 | return Ok(new List() { 33 | new EmployeeModel() { Id = 1, Name = "Employee 1" }, 34 | new EmployeeModel() { Id = 2, Name = "Employee 2"}} 35 | ); 36 | } 37 | 38 | [Route("{id}/basic")] 39 | public ActionResult GetEmployeeBasicDetails(int id) 40 | { 41 | if (id == 0) 42 | { 43 | return NotFound(); 44 | } 45 | 46 | return new EmployeeModel() { Id = 1, Name = "Employee 1" }; 47 | } 48 | 49 | [HttpGet("name")] 50 | public IActionResult GetName([FromServices] IProductRepository _productRepository) 51 | { 52 | var name = _productRepository.GetName(); 53 | return Ok(name); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Controllers/ProductController.cs: -------------------------------------------------------------------------------- 1 | using ConsoleToWebAPI.Models; 2 | using ConsoleToWebAPI.Repository; 3 | using Microsoft.AspNetCore.Http; 4 | using Microsoft.AspNetCore.Mvc; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Threading.Tasks; 9 | 10 | namespace ConsoleToWebAPI.Controllers 11 | { 12 | [Route("api/[controller]")] 13 | [ApiController] 14 | public class ProductController : ControllerBase 15 | { 16 | private readonly IProductRepository _productRepository; 17 | private readonly IProductRepository _productRepository1; 18 | 19 | public ProductController(IProductRepository productRepository, 20 | IProductRepository productRepository1) 21 | { 22 | _productRepository = productRepository; 23 | _productRepository1 = productRepository1; 24 | } 25 | 26 | [HttpPost("")] 27 | public IActionResult AddProduct([FromBody] ProductModel product) 28 | { 29 | _productRepository.AddProduct(product); 30 | var products = _productRepository1.GetAllProducts(); 31 | 32 | return Ok(products); 33 | } 34 | 35 | 36 | [HttpGet("")] 37 | public IActionResult GetName() 38 | { 39 | var name = _productRepository.GetName(); 40 | return Ok(name); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Controllers/TestController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleToWebAPI.Controllers 8 | { 9 | [ApiController] 10 | [Route("test/[action]")] 11 | public class TestController : ControllerBase 12 | { 13 | public string Get() 14 | { 15 | return "Hello from Get"; 16 | } 17 | 18 | public string Get1() 19 | { 20 | return "Hello from Get1"; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Controllers/ValuesController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | using Microsoft.AspNetCore.Mvc; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleToWebAPI.Controllers 9 | { 10 | 11 | [ApiController] 12 | [Route("[controller]/[action]")] 13 | public class ValuesController : ControllerBase 14 | { 15 | [Route("~/api/get-all")] 16 | [Route("~/getall")] 17 | [Route("~/get-all")] 18 | 19 | public string GetAll() 20 | { 21 | return "hello from get all"; 22 | } 23 | 24 | // [Route("api/get-all-authors")] 25 | 26 | //[Route("getall")] //this is not possible 27 | public string GetAllAuthors() 28 | { 29 | return "hello from get all authors"; 30 | } 31 | 32 | //[Route("books/{id}")] 33 | [Route("{id}")] 34 | public string GetById(int id) 35 | { 36 | return "hello "+id; 37 | } 38 | 39 | // [Route("books/{id}/author/{authorId}")] 40 | public string GetAuthorAddressById(int id, int authorId) 41 | { 42 | return "hello author address " + id +" " + authorId; 43 | } 44 | 45 | //[Route("search")] 46 | public string SeacrhBooks(int id, int authorId, string name, int rating, int price) 47 | { 48 | return "hello from search"; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/CustomBinder.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.ModelBinding; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleToWebAPI 8 | { 9 | public class CustomBinder : IModelBinder 10 | { 11 | public Task BindModelAsync(ModelBindingContext bindingContext) 12 | { 13 | var data = bindingContext.HttpContext.Request.Query; 14 | 15 | var result = data.TryGetValue("countries", out var country); 16 | 17 | if (result) 18 | { 19 | var array = country.ToString().Split('|'); 20 | 21 | bindingContext.Result = ModelBindingResult.Success(array); 22 | } 23 | 24 | return Task.CompletedTask; 25 | 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/CustomBinderCountryDetails.cs: -------------------------------------------------------------------------------- 1 | using ConsoleToWebAPI.Models; 2 | using Microsoft.AspNetCore.Mvc.ModelBinding; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | 8 | namespace ConsoleToWebAPI 9 | { 10 | public class CustomBinderCountryDetails : IModelBinder 11 | { 12 | public Task BindModelAsync(ModelBindingContext bindingContext) 13 | { 14 | var modelName = bindingContext.ModelName; 15 | var value = bindingContext.ValueProvider.GetValue(modelName); 16 | var result = value.FirstValue; 17 | 18 | if (!int.TryParse(result, out var id)) 19 | { 20 | return Task.CompletedTask; 21 | } 22 | 23 | var model = new CountryModel() 24 | { 25 | Id = id, 26 | Area = 400, 27 | Name = "India", 28 | Population = 500 29 | }; 30 | 31 | bindingContext.Result = ModelBindingResult.Success(model); 32 | 33 | return Task.CompletedTask; 34 | 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/CustomMiddleware1.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Http; 2 | using System.Threading.Tasks; 3 | 4 | namespace ConsoleToWebAPI 5 | { 6 | public class CustomMiddleware1 : IMiddleware 7 | { 8 | public async Task InvokeAsync(HttpContext context, RequestDelegate next) 9 | { 10 | await context.Response.WriteAsync("Hello from new file 1 \n"); 11 | 12 | await next(context); 13 | 14 | await context.Response.WriteAsync("Hello from new file 2 \n"); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Models/AnimalModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace ConsoleToWebAPI.Models 7 | { 8 | public class AnimalModel 9 | { 10 | public int Id { get; set; } 11 | public string Name { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Models/CountryModel.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleToWebAPI.Models 8 | { 9 | [ModelBinder(typeof(CustomBinderCountryDetails))] 10 | public class CountryModel 11 | { 12 | public int Id { get; set; } 13 | public string Name { get; set; } 14 | public int Population { get; set; } 15 | public int Area { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Models/EmployeeModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace ConsoleToWebAPI.Models 7 | { 8 | public class EmployeeModel 9 | { 10 | public int Id { get; set; } 11 | public string Name { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Models/ProductModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | 6 | namespace ConsoleToWebAPI.Models 7 | { 8 | public class ProductModel 9 | { 10 | public int Id { get; set; } 11 | public string Name { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Hosting; 3 | using System; 4 | 5 | namespace ConsoleToWebAPI 6 | { 7 | class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | CreateHostBuilder(args).Build().Run() ; 12 | } 13 | 14 | public static IHostBuilder CreateHostBuilder(string[] args) => 15 | Host.CreateDefaultBuilder(args) 16 | .ConfigureWebHostDefaults(webHost => 17 | { 18 | webHost.UseStartup(); 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iisSettings": { 3 | "windowsAuthentication": false, 4 | "anonymousAuthentication": true, 5 | "iisExpress": { 6 | "applicationUrl": "http://localhost:49944/", 7 | "sslPort": 44374 8 | } 9 | }, 10 | "profiles": { 11 | "IIS Express": { 12 | "commandName": "IISExpress", 13 | "launchBrowser": true, 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "ConsoleToWebAPI": { 19 | "commandName": "Project", 20 | "launchBrowser": true, 21 | "environmentVariables": { 22 | "ASPNETCORE_ENVIRONMENT": "Development" 23 | }, 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000" 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Repository/IProductRepository.cs: -------------------------------------------------------------------------------- 1 | using ConsoleToWebAPI.Models; 2 | using System.Collections.Generic; 3 | 4 | namespace ConsoleToWebAPI.Repository 5 | { 6 | public interface IProductRepository 7 | { 8 | int AddProduct(ProductModel product); 9 | List GetAllProducts(); 10 | 11 | string GetName(); 12 | } 13 | } -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Repository/ProductRepository.cs: -------------------------------------------------------------------------------- 1 | using ConsoleToWebAPI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleToWebAPI.Repository 8 | { 9 | public class ProductRepository : IProductRepository 10 | { 11 | private List products = new List(); 12 | public int AddProduct(ProductModel product) 13 | { 14 | product.Id = products.Count + 1; 15 | products.Add(product); 16 | return product.Id; 17 | } 18 | 19 | public List GetAllProducts() 20 | { 21 | return products; 22 | } 23 | 24 | public string GetName() 25 | { 26 | return "Name from ProductRepository"; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Repository/TestRepository.cs: -------------------------------------------------------------------------------- 1 | using ConsoleToWebAPI.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Threading.Tasks; 6 | 7 | namespace ConsoleToWebAPI.Repository 8 | { 9 | public class TestRepository : IProductRepository 10 | { 11 | public int AddProduct(ProductModel product) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | 16 | public List GetAllProducts() 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | 21 | public string GetName() 22 | { 23 | return "Name from TestRepository"; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/Startup.cs: -------------------------------------------------------------------------------- 1 | using ConsoleToWebAPI.Repository; 2 | using Microsoft.AspNetCore.Builder; 3 | using Microsoft.AspNetCore.Hosting; 4 | using Microsoft.AspNetCore.Http; 5 | using Microsoft.Extensions.DependencyInjection; 6 | using Microsoft.Extensions.DependencyInjection.Extensions; 7 | using Microsoft.Extensions.Hosting; 8 | using System; 9 | using System.Collections.Generic; 10 | using System.Linq; 11 | using System.Threading.Tasks; 12 | 13 | namespace ConsoleToWebAPI 14 | { 15 | public class Startup 16 | { 17 | public void ConfigureServices(IServiceCollection services) 18 | { 19 | services.AddControllers(); 20 | services.AddTransient(); 21 | 22 | 23 | services.TryAddTransient(); 24 | services.TryAddTransient(); 25 | } 26 | 27 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 28 | { 29 | //app.Run(async context => 30 | //{ 31 | // await context.Response.WriteAsync("Hello from Run"); 32 | //}); 33 | 34 | //app.Use(async (context, next) => 35 | //{ 36 | // await context.Response.WriteAsync("Hello from Use-1 1 \n"); 37 | 38 | // await next(); 39 | 40 | // await context.Response.WriteAsync("Hello from Use-1 2 \n"); 41 | //}); 42 | 43 | //app.UseMiddleware(); 44 | 45 | //app.Map("/nitish", CutomCode); 46 | 47 | //app.Use(async (context, next) => 48 | //{ 49 | // await context.Response.WriteAsync("Hello from Use-3 1 \n"); 50 | 51 | // await next(); 52 | 53 | // await context.Response.WriteAsync("Hello from Use-3 2 \n"); 54 | //}); 55 | 56 | //app.Use(async (context, next) => 57 | //{ 58 | // await context.Response.WriteAsync("Request complete \n"); 59 | //}); 60 | 61 | //app.Run(async context => 62 | //{ 63 | // await context.Response.WriteAsync("Hello from Run \n"); 64 | //}); 65 | 66 | if (env.IsDevelopment()) 67 | { 68 | app.UseDeveloperExceptionPage(); 69 | } 70 | 71 | app.UseRouting(); 72 | 73 | app.UseEndpoints(endpoints => 74 | { 75 | endpoints.MapControllers(); 76 | }); 77 | } 78 | 79 | private void CutomCode(IApplicationBuilder app) 80 | { 81 | app.Use(async (context, next) => 82 | { 83 | await context.Response.WriteAsync("Hello from nitish \n"); 84 | }); 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/net5.0/ConsoleToWebAPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/bin/Debug/net5.0/ConsoleToWebAPI.dll -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/net5.0/ConsoleToWebAPI.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/bin/Debug/net5.0/ConsoleToWebAPI.exe -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/net5.0/ConsoleToWebAPI.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/bin/Debug/net5.0/ConsoleToWebAPI.pdb -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/net5.0/ConsoleToWebAPI.runtimeconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "additionalProbingPaths": [ 4 | "C:\\Users\\kaush\\.dotnet\\store\\|arch|\\|tfm|", 5 | "C:\\Users\\kaush\\.nuget\\packages" 6 | ] 7 | } 8 | } -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/net5.0/ConsoleToWebAPI.runtimeconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "tfm": "net5.0", 4 | "framework": { 5 | "name": "Microsoft.AspNetCore.App", 6 | "version": "5.0.0" 7 | }, 8 | "configProperties": { 9 | "System.GC.Server": true, 10 | "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/net5.0/ref/ConsoleToWebAPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/bin/Debug/net5.0/ref/ConsoleToWebAPI.dll -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/netcoreapp3.1/ConsoleToWebAPI.deps.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeTarget": { 3 | "name": ".NETCoreApp,Version=v3.1", 4 | "signature": "" 5 | }, 6 | "compilationOptions": {}, 7 | "targets": { 8 | ".NETCoreApp,Version=v3.1": { 9 | "ConsoleToWebAPI/1.0.0": { 10 | "runtime": { 11 | "ConsoleToWebAPI.dll": {} 12 | } 13 | } 14 | } 15 | }, 16 | "libraries": { 17 | "ConsoleToWebAPI/1.0.0": { 18 | "type": "project", 19 | "serviceable": false, 20 | "sha512": "" 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/netcoreapp3.1/ConsoleToWebAPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/bin/Debug/netcoreapp3.1/ConsoleToWebAPI.dll -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/netcoreapp3.1/ConsoleToWebAPI.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/bin/Debug/netcoreapp3.1/ConsoleToWebAPI.exe -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/netcoreapp3.1/ConsoleToWebAPI.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/bin/Debug/netcoreapp3.1/ConsoleToWebAPI.pdb -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/netcoreapp3.1/ConsoleToWebAPI.runtimeconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "additionalProbingPaths": [ 4 | "C:\\Users\\kaush\\.dotnet\\store\\|arch|\\|tfm|", 5 | "C:\\Users\\kaush\\.nuget\\packages" 6 | ] 7 | } 8 | } -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/bin/Debug/netcoreapp3.1/ConsoleToWebAPI.runtimeconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "runtimeOptions": { 3 | "tfm": "netcoreapp3.1", 4 | "framework": { 5 | "name": "Microsoft.NETCore.App", 6 | "version": "3.1.0" 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/ConsoleToWebAPI.csproj.nuget.dgspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "format": 1, 3 | "restore": { 4 | "D:\\Web API Core\\Console to web api\\ConsoleToWebAPI\\ConsoleToWebAPI\\ConsoleToWebAPI.csproj": {} 5 | }, 6 | "projects": { 7 | "D:\\Web API Core\\Console to web api\\ConsoleToWebAPI\\ConsoleToWebAPI\\ConsoleToWebAPI.csproj": { 8 | "version": "1.0.0", 9 | "restore": { 10 | "projectUniqueName": "D:\\Web API Core\\Console to web api\\ConsoleToWebAPI\\ConsoleToWebAPI\\ConsoleToWebAPI.csproj", 11 | "projectName": "ConsoleToWebAPI", 12 | "projectPath": "D:\\Web API Core\\Console to web api\\ConsoleToWebAPI\\ConsoleToWebAPI\\ConsoleToWebAPI.csproj", 13 | "packagesPath": "C:\\Users\\kaush\\.nuget\\packages\\", 14 | "outputPath": "D:\\Web API Core\\Console to web api\\ConsoleToWebAPI\\ConsoleToWebAPI\\obj\\", 15 | "projectStyle": "PackageReference", 16 | "configFilePaths": [ 17 | "C:\\Users\\kaush\\AppData\\Roaming\\NuGet\\NuGet.Config", 18 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 19 | ], 20 | "originalTargetFrameworks": [ 21 | "net5.0" 22 | ], 23 | "sources": { 24 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 25 | "https://api.nuget.org/v3/index.json": {} 26 | }, 27 | "frameworks": { 28 | "net5.0": { 29 | "targetAlias": "net5.0", 30 | "projectReferences": {} 31 | } 32 | }, 33 | "warningProperties": { 34 | "warnAsError": [ 35 | "NU1605" 36 | ] 37 | } 38 | }, 39 | "frameworks": { 40 | "net5.0": { 41 | "targetAlias": "net5.0", 42 | "imports": [ 43 | "net461", 44 | "net462", 45 | "net47", 46 | "net471", 47 | "net472", 48 | "net48" 49 | ], 50 | "assetTargetFallback": true, 51 | "warn": true, 52 | "frameworkReferences": { 53 | "Microsoft.AspNetCore.App": { 54 | "privateAssets": "none" 55 | }, 56 | "Microsoft.NETCore.App": { 57 | "privateAssets": "all" 58 | } 59 | }, 60 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.103\\RuntimeIdentifierGraph.json" 61 | } 62 | } 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/ConsoleToWebAPI.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\kaush\.nuget\packages\ 9 | PackageReference 10 | 5.8.1 11 | 12 | 13 | 14 | 15 | 16 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 17 | 18 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/ConsoleToWebAPI.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | 6 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/.NETCoreApp,Version=v5.0.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v5.0", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("ConsoleToWebAPI")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 16 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 17 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 18 | [assembly: System.Reflection.AssemblyProductAttribute("ConsoleToWebAPI")] 19 | [assembly: System.Reflection.AssemblyTitleAttribute("ConsoleToWebAPI")] 20 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 21 | 22 | // Generated by the MSBuild WriteCodeFragment class. 23 | 24 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | 29af3c384258feb9fb391cb8ac829ce4f10dc2b7 2 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.GeneratedMSBuildEditorConfig.editorconfig: -------------------------------------------------------------------------------- 1 | is_global = true 2 | build_property.TargetFramework = net5.0 3 | build_property.TargetPlatformMinVersion = 4 | build_property.UsingMicrosoftNETSdkWeb = true 5 | build_property.ProjectTypeGuids = 6 | build_property.PublishSingleFile = 7 | build_property.IncludeAllContentForSelfExtract = 8 | build_property._SupportedPlatformList = Android,iOS,Linux,macOS,Windows 9 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.MvcApplicationPartsAssemblyInfo.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.MvcApplicationPartsAssemblyInfo.cache -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.RazorTargetAssemblyInfo.cache: -------------------------------------------------------------------------------- 1 | 1c09685ae6e4500a485d66766b0d65f2f0b74349 2 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.assets.cache -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 47216423e97afbe587a0be76a308f1934723ffee 2 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\net5.0\ConsoleToWebAPI.exe 2 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\net5.0\ConsoleToWebAPI.deps.json 3 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\net5.0\ConsoleToWebAPI.runtimeconfig.json 4 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\net5.0\ConsoleToWebAPI.runtimeconfig.dev.json 5 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\net5.0\ConsoleToWebAPI.dll 6 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\net5.0\ref\ConsoleToWebAPI.dll 7 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\net5.0\ConsoleToWebAPI.pdb 8 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\ConsoleToWebAPI.GeneratedMSBuildEditorConfig.editorconfig 9 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\ConsoleToWebAPI.AssemblyInfoInputs.cache 10 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\ConsoleToWebAPI.AssemblyInfo.cs 11 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\ConsoleToWebAPI.csproj.CoreCompileInputs.cache 12 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\ConsoleToWebAPI.MvcApplicationPartsAssemblyInfo.cache 13 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\staticwebassets\ConsoleToWebAPI.StaticWebAssets.Manifest.cache 14 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\staticwebassets\ConsoleToWebAPI.StaticWebAssets.xml 15 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\scopedcss\bundle\ConsoleToWebAPI.styles.css 16 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\ConsoleToWebAPI.RazorTargetAssemblyInfo.cache 17 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\ConsoleToWebAPI.dll 18 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\ref\ConsoleToWebAPI.dll 19 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\ConsoleToWebAPI.pdb 20 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\ConsoleToWebAPI.genruntimeconfig.cache 21 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\net5.0\ConsoleToWebAPI.csprojAssemblyReference.cache 22 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.dll -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.genruntimeconfig.cache: -------------------------------------------------------------------------------- 1 | 1f3b11fd61bab3c55d804426413e1947ed54aa13 2 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ConsoleToWebAPI.pdb -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/apphost.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/apphost.exe -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ref/ConsoleToWebAPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/ref/ConsoleToWebAPI.dll -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/staticwebassets/ConsoleToWebAPI.StaticWebAssets.Manifest.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/staticwebassets/ConsoleToWebAPI.StaticWebAssets.Manifest.cache -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/net5.0/staticwebassets/ConsoleToWebAPI.StaticWebAssets.xml: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/.NETCoreApp,Version=v3.1.AssemblyAttributes.cs: -------------------------------------------------------------------------------- 1 | // 2 | using System; 3 | using System.Reflection; 4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v3.1", FrameworkDisplayName = "")] 5 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("ConsoleToWebAPI")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 16 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 17 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 18 | [assembly: System.Reflection.AssemblyProductAttribute("ConsoleToWebAPI")] 19 | [assembly: System.Reflection.AssemblyTitleAttribute("ConsoleToWebAPI")] 20 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 21 | 22 | // Generated by the MSBuild WriteCodeFragment class. 23 | 24 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | 29af3c384258feb9fb391cb8ac829ce4f10dc2b7 2 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.assets.cache -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | 5e9f202cf455cb896c88d680fe8b23d174fb67f4 2 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\netcoreapp3.1\ConsoleToWebAPI.exe 2 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\netcoreapp3.1\ConsoleToWebAPI.deps.json 3 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\netcoreapp3.1\ConsoleToWebAPI.runtimeconfig.json 4 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\netcoreapp3.1\ConsoleToWebAPI.runtimeconfig.dev.json 5 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\netcoreapp3.1\ConsoleToWebAPI.dll 6 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\bin\Debug\netcoreapp3.1\ConsoleToWebAPI.pdb 7 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\netcoreapp3.1\ConsoleToWebAPI.csprojAssemblyReference.cache 8 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\netcoreapp3.1\ConsoleToWebAPI.AssemblyInfoInputs.cache 9 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\netcoreapp3.1\ConsoleToWebAPI.AssemblyInfo.cs 10 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\netcoreapp3.1\ConsoleToWebAPI.csproj.CoreCompileInputs.cache 11 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\netcoreapp3.1\ConsoleToWebAPI.dll 12 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\netcoreapp3.1\ConsoleToWebAPI.pdb 13 | D:\Web API Core\Console to web api\ConsoleToWebAPI\ConsoleToWebAPI\obj\Debug\netcoreapp3.1\ConsoleToWebAPI.genruntimeconfig.cache 14 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.csprojAssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.csprojAssemblyReference.cache -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.dll -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.genruntimeconfig.cache: -------------------------------------------------------------------------------- 1 | 6ca5f067c9bf0eebe0c6a2d960bedc20415ed7e2 2 | -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/ConsoleToWebAPI.pdb -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/apphost.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nitish-kaushik/asp-net-core-web-api/79286fb0e3b5b59bba613f1441b709b7c8d4faf4/Fundamentals/ConsoleToWebAPI/obj/Debug/netcoreapp3.1/apphost.exe -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/project.assets.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "targets": { 4 | "net5.0": {} 5 | }, 6 | "libraries": {}, 7 | "projectFileDependencyGroups": { 8 | "net5.0": [] 9 | }, 10 | "packageFolders": { 11 | "C:\\Users\\kaush\\.nuget\\packages\\": {} 12 | }, 13 | "project": { 14 | "version": "1.0.0", 15 | "restore": { 16 | "projectUniqueName": "D:\\Web API Core\\Console to web api\\ConsoleToWebAPI\\ConsoleToWebAPI\\ConsoleToWebAPI.csproj", 17 | "projectName": "ConsoleToWebAPI", 18 | "projectPath": "D:\\Web API Core\\Console to web api\\ConsoleToWebAPI\\ConsoleToWebAPI\\ConsoleToWebAPI.csproj", 19 | "packagesPath": "C:\\Users\\kaush\\.nuget\\packages\\", 20 | "outputPath": "D:\\Web API Core\\Console to web api\\ConsoleToWebAPI\\ConsoleToWebAPI\\obj\\", 21 | "projectStyle": "PackageReference", 22 | "configFilePaths": [ 23 | "C:\\Users\\kaush\\AppData\\Roaming\\NuGet\\NuGet.Config", 24 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 25 | ], 26 | "originalTargetFrameworks": [ 27 | "net5.0" 28 | ], 29 | "sources": { 30 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 31 | "https://api.nuget.org/v3/index.json": {} 32 | }, 33 | "frameworks": { 34 | "net5.0": { 35 | "targetAlias": "net5.0", 36 | "projectReferences": {} 37 | } 38 | }, 39 | "warningProperties": { 40 | "warnAsError": [ 41 | "NU1605" 42 | ] 43 | } 44 | }, 45 | "frameworks": { 46 | "net5.0": { 47 | "targetAlias": "net5.0", 48 | "imports": [ 49 | "net461", 50 | "net462", 51 | "net47", 52 | "net471", 53 | "net472", 54 | "net48" 55 | ], 56 | "assetTargetFallback": true, 57 | "warn": true, 58 | "frameworkReferences": { 59 | "Microsoft.AspNetCore.App": { 60 | "privateAssets": "none" 61 | }, 62 | "Microsoft.NETCore.App": { 63 | "privateAssets": "all" 64 | } 65 | }, 66 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\5.0.103\\RuntimeIdentifierGraph.json" 67 | } 68 | } 69 | } 70 | } -------------------------------------------------------------------------------- /Fundamentals/ConsoleToWebAPI/obj/project.nuget.cache: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "dgSpecHash": "v2M5Jv7kvN2x9FblcgYEyKANDAId4ZBRAOm9NhDq7olhKQNdVJsK79Y99Uaoil6Sg5xJJtCKKD+ud7lmNEITLw==", 4 | "success": true, 5 | "projectFilePath": "D:\\Web API Core\\Console to web api\\ConsoleToWebAPI\\ConsoleToWebAPI\\ConsoleToWebAPI.csproj", 6 | "expectedPackageFiles": [], 7 | "logs": [] 8 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Nitish Kumar 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 | # asp-net-core-web-api --------------------------------------------------------------------------------