This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Builder; | |
using Microsoft.AspNetCore.Hosting; | |
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
namespace BooksWebApi | |
{ | |
public class Startup | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace BooksWebApi.Entities | |
{ | |
public class Category | |
{ | |
public long Id { get; set; } | |
public string Description { get; set; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace BooksWebApi.Entities | |
{ | |
public class Book | |
{ | |
public long Id { get; set; } | |
public string Name { get; set; } | |
public string AuthorName { get; set; } | |
public int Edition { get; set; } | |
public DateTime PublicationDate { get; set; } | |
public string ISDN { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace BooksWebApi.Entities | |
{ | |
public class Category | |
{ | |
public long Id { get; set; } | |
public string Description { get; set; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Identity; | |
namespace BooksWebApi.Entities | |
{ | |
public class User : IdentityUser | |
{ | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace BooksWebApi.Entities | |
{ | |
public class Category | |
{ | |
public long Id { get; set; } | |
public string Description { get; set; } | |
public List<Book>Books { get; set; } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Startup | |
{ | |
public IConfiguration Configuration { get; set; } | |
public Startup(IHostingEnvironment env) | |
{ | |
var builder = new ConfigurationBuilder() | |
.SetBasePath(env.ContentRootPath) | |
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) | |
.AddEnvironmentVariables(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BooksCatalogDbContext : IdentityDbContext | |
{ | |
public BooksCatalogDbContext(DbContextOptions<BooksCatalogDbContext> options) | |
: base(options) | |
{ | |
} | |
public DbSet<Book> Books { get; set; } | |
public DbSet<Category> Categories { get; set; } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ConnectionStrings": { | |
"DefaultConnection": "Data Source=HOST\\SQLEXPRESS;Initial Catalog=DbBooksCat;Connect Timeout=30;Encrypt=False; Integrated Security=SSPI;" | |
}, | |
"Logging": { | |
"IncludeScopes": false, | |
"Debug": { | |
"LogLevel": { | |
"Default": "Debug" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using BooksWebApi.Data; | |
using BooksWebApi.Entities; | |
using Microsoft.EntityFrameworkCore; | |
public class CrudRepository : ICrudRepository | |
{ |
OlderNewer