Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7adc85d

Browse files
Uploading Project on Github
0 parents commit 7adc85d

File tree

127 files changed

+29928
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+29928
-0
lines changed
127 KB
Binary file not shown.

‎.vs/Book-Store-Application/config/applicationhost.config‎

Lines changed: 988 additions & 0 deletions
Large diffs are not rendered by default.

‎.vs/Book-Store-Application/v16/.suo‎

95.5 KB
Binary file not shown.

‎Book-Store-Application.sln‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.33130.400
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Book-Store-Application", "Book-Store-Application\Book-Store-Application.csproj", "{3A794913-9C1B-43B6-AD76-3BC4C824DF27}"
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+
{3A794913-9C1B-43B6-AD76-3BC4C824DF27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{3A794913-9C1B-43B6-AD76-3BC4C824DF27}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{3A794913-9C1B-43B6-AD76-3BC4C824DF27}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{3A794913-9C1B-43B6-AD76-3BC4C824DF27}.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 = {81D397A7-780E-4DE7-B2D7-99277FCDE219}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net5.0</TargetFramework>
5+
<RootNamespace>Book_Store_Application</RootNamespace>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
10+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0" />
11+
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.0" />
12+
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.0" />
13+
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="5.0.3" />
14+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.3" />
15+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.17" />
16+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.3">
17+
<PrivateAssets>all</PrivateAssets>
18+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
19+
</PackageReference>
20+
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Design" Version="1.1.6" />
21+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.3" />
22+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.3">
23+
<PrivateAssets>all</PrivateAssets>
24+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
25+
</PackageReference>
26+
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="7.0.2" />
27+
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="5.0.0" />
28+
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
29+
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
30+
</ItemGroup>
31+
32+
</Project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Controller_SelectedScaffolderID>ApiControllerEmptyScaffolder</Controller_SelectedScaffolderID>
5+
<Controller_SelectedScaffolderCategoryPath>root/Common/Api</Controller_SelectedScaffolderCategoryPath>
6+
</PropertyGroup>
7+
</Project>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using Book_Store_Application.Models;
2+
using Book_Store_Application.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 Book_Store_Application.Controllers
11+
{
12+
[Route("api")]
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<IActionResult> Signup([FromBody] Signup signup )
25+
{
26+
var result =await _accountRepository.SignupAsync(signup);
27+
if (result.Succeeded)
28+
return Ok($"User Added Successfully \n{result.Succeeded}");
29+
return Unauthorized();
30+
}
31+
[HttpPost("Signin")]
32+
public async Task<IActionResult> Signin([FromBody] Login login)
33+
{
34+
var result = await _accountRepository.LoginAsync(login);
35+
if (string.IsNullOrEmpty(result))
36+
return Unauthorized();
37+
return Ok(result);
38+
}
39+
}
40+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
using Book_Store_Application.Models;
2+
using Book_Store_Application.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 Book_Store_Application.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+
public async Task<IActionResult> GetAllBooks()
28+
{
29+
var books = await _bookRepository.GetAllBookAsync();
30+
return Ok(books);
31+
}
32+
[HttpGet("FindBook/{id}")]
33+
public async Task<IActionResult> GetBookById([FromRoute] int id)
34+
{
35+
var book = await _bookRepository.GetBookByIdAsync(id);
36+
if (book == null)
37+
return NotFound();
38+
return Ok(book);
39+
}
40+
[HttpPost("AddBook")]
41+
public async Task<IActionResult> AddNewBook([FromBody] BookModel bookModel)
42+
{
43+
var id = await _bookRepository.AddBookAsync(bookModel);
44+
return CreatedAtAction(nameof(GetBookById),new { id = id , controller = "books"} , $"Book Added Successfully.\nYour Book Id Is : {id}");
45+
}
46+
[HttpPut("UpdateBook/{id}")]
47+
public async Task<IActionResult> UpdateBook([FromBody] BookModel bookModel,[FromRoute] int id)
48+
{
49+
await _bookRepository.UpdateBookAsync(id,bookModel);
50+
return Ok("Book Updated Successfully....");
51+
}
52+
[HttpPatch("UpdateBook/{id}")]
53+
public async Task<IActionResult> UpdateBookPatch([FromBody] JsonPatchDocument bookModel, [FromRoute] int id)
54+
{
55+
await _bookRepository.UpdateBookPatchAsync(id, bookModel);
56+
return Ok("Book Updated Successfully....");
57+
}
58+
[HttpDelete("DeleteBook/{id}")]
59+
public async Task<IActionResult> DeleteBook([FromRoute] int id)
60+
{
61+
await _bookRepository.DeleteBookAsync(id);
62+
return Ok("Book Deleted Successfully....");
63+
}
64+
65+
}
66+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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 Book_Store_Application.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<WeatherForecastController> _logger;
20+
21+
public WeatherForecastController(ILogger<WeatherForecastController> logger)
22+
{
23+
_logger = logger;
24+
}
25+
26+
[HttpGet]
27+
public IEnumerable<WeatherForecast> 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+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using Book_Store_Application.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 Book_Store_Application.Data
10+
{
11+
public class BookStoreContext : IdentityDbContext<ApplicationUser>
12+
{
13+
public BookStoreContext(DbContextOptions<BookStoreContext> options):base(options)
14+
{
15+
16+
}
17+
public DbSet<Books> Books { get; set; }
18+
19+
}
20+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /