diff --git a/exercise.webapi/DTO/Author_get.cs b/exercise.webapi/DTO/Author_get.cs new file mode 100644 index 0000000..adf4716 --- /dev/null +++ b/exercise.webapi/DTO/Author_get.cs @@ -0,0 +1,23 @@ +using exercise.webapi.Models; + +namespace exercise.webapi.DTO +{ + public class Author_get + { + public Author_get(Author author) + { + this.Id = author.Id; + this.FirstName = author.FirstName; + this.LastName = author.LastName; + this.Email = author.Email; + this.Books = author.Books.Select(x => new Author_get_Book(x)).ToList(); + } + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + + public ICollection Books { get; set; } = new List(); + + } +} diff --git a/exercise.webapi/DTO/Author_get_Book.cs b/exercise.webapi/DTO/Author_get_Book.cs new file mode 100644 index 0000000..7f4b1fb --- /dev/null +++ b/exercise.webapi/DTO/Author_get_Book.cs @@ -0,0 +1,17 @@ +using exercise.webapi.Models; + +namespace exercise.webapi.DTO +{ + public class Author_get_Book + { + public Author_get_Book(Book book) + { + this.Id = book.Id; + this.Title = book.Title; + this.Publisher = new Book_get_Publisher(book.Publisher); + } + public int Id { get; set; } + public string Title { get; set; } + public Book_get_Publisher Publisher { get; set; } + } +} diff --git a/exercise.webapi/DTO/Book_create.cs b/exercise.webapi/DTO/Book_create.cs new file mode 100644 index 0000000..5163536 --- /dev/null +++ b/exercise.webapi/DTO/Book_create.cs @@ -0,0 +1,12 @@ +using exercise.webapi.Models; + +namespace exercise.webapi.DTO +{ + public class Book_create + { + public string Title { get; set; } + public int AuthorId { get; set; } + public int PublisherId { get; set; } + + } +} diff --git a/exercise.webapi/DTO/Book_get.cs b/exercise.webapi/DTO/Book_get.cs new file mode 100644 index 0000000..360ea84 --- /dev/null +++ b/exercise.webapi/DTO/Book_get.cs @@ -0,0 +1,19 @@ +using exercise.webapi.Models; + +namespace exercise.webapi.DTO +{ + public class Book_get + { + public Book_get(Book book) + { + this.Id = book.Id; + this.Title = book.Title; + this.Author = new Book_get_Author(book.Author); + this.Publisher = new Book_get_Publisher(book.Publisher); + } + public int Id { get; set; } + public string Title { get; set; } + public Book_get_Author Author { get; set; } + public Book_get_Publisher Publisher { get; set; } + } +} diff --git a/exercise.webapi/DTO/Book_get_Author.cs b/exercise.webapi/DTO/Book_get_Author.cs new file mode 100644 index 0000000..b1420f5 --- /dev/null +++ b/exercise.webapi/DTO/Book_get_Author.cs @@ -0,0 +1,20 @@ +using exercise.webapi.Models; + +namespace exercise.webapi.DTO +{ + public class Book_get_Author + { + public Book_get_Author(Author author) + { + this.Id = author.Id; + this.FirstName = author.FirstName; + this.LastName = author.LastName; + this.Email = author.Email; + } + public int Id { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + public string Email { get; set; } + + } +} diff --git a/exercise.webapi/DTO/Book_get_Publisher.cs b/exercise.webapi/DTO/Book_get_Publisher.cs new file mode 100644 index 0000000..37f7733 --- /dev/null +++ b/exercise.webapi/DTO/Book_get_Publisher.cs @@ -0,0 +1,17 @@ +using exercise.webapi.Models; + +namespace exercise.webapi.DTO +{ + public class Book_get_Publisher + { + public Book_get_Publisher(Publisher publisher) + { + this.Id = publisher.Id; + this.Name = publisher.Name; + } + public int Id { get; set; } + public string Name { get; set; } + + + } +} diff --git a/exercise.webapi/DTO/Book_update.cs b/exercise.webapi/DTO/Book_update.cs new file mode 100644 index 0000000..73f826c --- /dev/null +++ b/exercise.webapi/DTO/Book_update.cs @@ -0,0 +1,10 @@ +using exercise.webapi.Models; + +namespace exercise.webapi.DTO +{ + public class Book_update + { + public int AuthorId { get; set; } + + } +} diff --git a/exercise.webapi/DTO/Publisher_get.cs b/exercise.webapi/DTO/Publisher_get.cs new file mode 100644 index 0000000..6b38f0f --- /dev/null +++ b/exercise.webapi/DTO/Publisher_get.cs @@ -0,0 +1,18 @@ +using exercise.webapi.Models; + +namespace exercise.webapi.DTO +{ + public class Publisher_get + { + public Publisher_get(Publisher publisher) + { + this.Id = publisher.Id; + this.Name = publisher.Name; + this.books = publisher.Books.Select(x => new Publisher_get_Book(x)).ToList(); + } + public int Id { get; set; } + public string Name { get; set; } + public List books { get; set; } + + } +} diff --git a/exercise.webapi/DTO/Publisher_get_Book.cs b/exercise.webapi/DTO/Publisher_get_Book.cs new file mode 100644 index 0000000..3e801ef --- /dev/null +++ b/exercise.webapi/DTO/Publisher_get_Book.cs @@ -0,0 +1,17 @@ +using exercise.webapi.Models; + +namespace exercise.webapi.DTO +{ + public class Publisher_get_Book + { + public Publisher_get_Book(Book book) + { + this.Id = book.Id; + this.Title = book.Title; + this.Author = new Book_get_Author(book.Author); + } + public int Id { get; set; } + public string Title { get; set; } + public Book_get_Author Author { get; set; } + } +} diff --git a/exercise.webapi/Data/DataContext.cs b/exercise.webapi/Data/DataContext.cs index b6be7a9..714d2d2 100644 --- a/exercise.webapi/Data/DataContext.cs +++ b/exercise.webapi/Data/DataContext.cs @@ -24,9 +24,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity().HasData(seeder.Authors); modelBuilder.Entity().HasData(seeder.Books); - + modelBuilder.Entity().HasData(seeder.Publishers); } public DbSet Authors { get; set; } public DbSet Books { get; set; } + public DbSet Publishers { get; set; } } } diff --git a/exercise.webapi/Data/Seeder.cs b/exercise.webapi/Data/Seeder.cs index 955e3c8..e757896 100644 --- a/exercise.webapi/Data/Seeder.cs +++ b/exercise.webapi/Data/Seeder.cs @@ -1,4 +1,5 @@ -using exercise.webapi.Models; +using System.Diagnostics; +using exercise.webapi.Models; namespace exercise.webapi.Data { @@ -76,15 +77,60 @@ public class Seeder "Flowers", "Leopards" }; + + private List> _publisherWords= new List>() + { + new List{ + "Jumbled", + "Frantic", + "Scrambled", + "Caffeinated", + "Unraveled", + "Overloaded", + "Lost", + "Infinite", + "Radiant", + "Majestic", + + }, + new List{ + "Byte", + "Paw", + "Script", + "Code", + "Whisker", + "Studios", + "Co.", + "Works", + "Lab", + "Collective", + "Ventures", + "Agency", + "Bureau", + }, + new List{ + "Press", + "Concepts", + "Enterprises", + "Projects", + "Publications", + "Systems", + "Industries", + "Studios", + "Solutions", + }, + }; private List _authors = new List(); private List _books = new List(); + private List _publishers = new List(); public Seeder() { Random authorRandom = new Random(); Random bookRandom = new Random(); + Random publisherRandom = new Random(); @@ -98,6 +144,13 @@ public Seeder() _authors.Add(author); } + for (int z = 1; z < 250; z++) + { + Publisher publisher = new Publisher(); + publisher.Id = z; + publisher.Name = $"{_publisherWords[0][publisherRandom.Next(_publisherWords[0].Count)]} {_publisherWords[1][publisherRandom.Next(_publisherWords[1].Count)]} {_publisherWords[2][publisherRandom.Next(_publisherWords[2].Count)]}"; + _publishers.Add(publisher); + } for (int y = 1; y < 250; y++) { @@ -105,13 +158,16 @@ public Seeder() book.Id = y; book.Title = $"{_firstword[bookRandom.Next(_firstword.Count)]} {_secondword[bookRandom.Next(_secondword.Count)]} {_thirdword[bookRandom.Next(_thirdword.Count)]}"; book.AuthorId = _authors[authorRandom.Next(_authors.Count)].Id; + book.PublisherId = _publishers[publisherRandom.Next(_publishers.Count)].Id; //book.Author = authors[book.AuthorId-1]; _books.Add(book); } + } public List Authors { get { return _authors; } } public List Books { get { return _books; } } + public List Publishers { get { return _publishers; } } } } diff --git a/exercise.webapi/Endpoints/AuthorApi.cs b/exercise.webapi/Endpoints/AuthorApi.cs new file mode 100644 index 0000000..1866d49 --- /dev/null +++ b/exercise.webapi/Endpoints/AuthorApi.cs @@ -0,0 +1,35 @@ +using exercise.webapi.DTO; +using exercise.webapi.Repository; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Mvc; + +namespace exercise.webapi.Endpoints +{ + public static class AuthorApi + { + public static void ConfigureAuthorsApi(this WebApplication app) + { + var authors = app.MapGroup("/authors"); + authors.MapGet("/", GetAuthors); + authors.MapGet("/{id}", GetAuthor); + } + + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + private static async Task GetAuthors(IAuthorRepository authorRepository) + { + var authors = await authorRepository.GetAllAuthors(); + if (authors.Count() == 0) return TypedResults.NotFound($"No authors found in the database"); + return TypedResults.Ok(authors.Select(x => new Author_get(x))); + } + + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + private static async Task GetAuthor(IAuthorRepository authorRepository, int id) + { + var author = await authorRepository.GetAuthor(id); + if (author == null) return TypedResults.NotFound($"No author with id[{id}] exists"); + return TypedResults.Ok(new Author_get(author)); + } + } +} diff --git a/exercise.webapi/Endpoints/BookApi.cs b/exercise.webapi/Endpoints/BookApi.cs index 6758215..70cdeff 100644 --- a/exercise.webapi/Endpoints/BookApi.cs +++ b/exercise.webapi/Endpoints/BookApi.cs @@ -1,5 +1,8 @@ -using exercise.webapi.Models; +using System; +using exercise.webapi.DTO; +using exercise.webapi.Models; using exercise.webapi.Repository; +using Microsoft.AspNetCore.Mvc; using static System.Reflection.Metadata.BlobBuilder; namespace exercise.webapi.Endpoints @@ -8,13 +11,88 @@ public static class BookApi { public static void ConfigureBooksApi(this WebApplication app) { - app.MapGet("/books", GetBooks); + var books = app.MapGroup("/books"); + books.MapGet("/", GetBooks); + books.MapPost("/", CreateBook); + books.MapGet("/{id}", GetBook); + books.MapPut("/{id}", UpdateBook); + books.MapDelete("/{id}", DeleteBook); } + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + private static async Task DeleteBook(HttpContext context, IBookRepository bookRepository, int id) + { + try + { + var b = await bookRepository.DeleteBook(id); + return TypedResults.Ok(new Book_get(b)); + } + catch (Exception ex) + { + return TypedResults.NotFound("Invalid book data"); + } + } + [ProducesResponseType(StatusCodes.Status201Created)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + private static async Task UpdateBook(HttpContext context, IBookRepository bookRepository, IAuthorRepository authorRepository, IPublisherRepository publisherRepository, int id, Book_update dto) + { + try + { + var author = await authorRepository.GetAuthor(dto.AuthorId); + if (author == null) return TypedResults.NotFound($"Book can't be updated to use AuthorId[{dto.AuthorId}], as no Author was found"); + var book = await bookRepository.GetBook(id); + if (book == null) return TypedResults.NotFound($"Book can't be updated, no book with id[{id}] exists"); + var b = await bookRepository.UpdateBook(id, author); + + var url = $"{context.Request.Scheme}://{context.Request.Host}{context.Request.Path}"; + return TypedResults.Created($"{url}/{b.Id}", new Book_get(b)); + } + catch (Exception ex) + { + return TypedResults.BadRequest("Invalid book data"); + } + } + + [ProducesResponseType(StatusCodes.Status201Created)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + [ProducesResponseType(StatusCodes.Status400BadRequest)] + private static async Task CreateBook(HttpContext context, IBookRepository bookRepository, IAuthorRepository authorRepository, IPublisherRepository publisherRepository, Book_create dto) + { + try + { + var author = await authorRepository.GetAuthor(dto.AuthorId); + if (author == null)return TypedResults.NotFound($"Book can't be created with AuthorId[{dto.AuthorId}], as no Author was found"); + var publisher = await publisherRepository.GetPublisher(dto.PublisherId); + if (publisher == null) return TypedResults.NotFound($"Book can't be created with PublisherId[{dto.PublisherId}], as no Publisher was found"); + var b = await bookRepository.CreateBook(dto.Title, dto.AuthorId, author, dto.PublisherId, publisher ); + + var url = $"{context.Request.Scheme}://{context.Request.Host}{context.Request.Path}"; + return TypedResults.Created($"{url}/{b.Id}", new Book_get(b)); + } + catch (Exception ex) + { + return TypedResults.BadRequest("Invalid book data"); + } + } + + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] private static async Task GetBooks(IBookRepository bookRepository) { var books = await bookRepository.GetAllBooks(); - return TypedResults.Ok(books); + if (books.Count() == 0) return TypedResults.NotFound($"No books found in the database"); + return TypedResults.Ok(books.Select(x => new Book_get(x)).ToList()); + } + + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + private static async Task GetBook(IBookRepository bookRepository, int id) + { + var book = await bookRepository.GetBook(id); + if (book== null) return TypedResults.NotFound($"No book with id[{id}] exists"); + return TypedResults.Ok(new Book_get(book)); } } } diff --git a/exercise.webapi/Endpoints/PublisherApi.cs b/exercise.webapi/Endpoints/PublisherApi.cs new file mode 100644 index 0000000..48a96f3 --- /dev/null +++ b/exercise.webapi/Endpoints/PublisherApi.cs @@ -0,0 +1,34 @@ +using exercise.webapi.DTO; +using exercise.webapi.Repository; +using Microsoft.AspNetCore.Mvc; + +namespace exercise.webapi.Endpoints +{ + public static class PublisherApi + { + public static void ConfigurePublisherApi(this WebApplication app) + { + var publishers = app.MapGroup("/publishers"); + publishers.MapGet("/", GetPublishers); + publishers.MapGet("/{id}", GetPublisher); + } + + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + private static async Task GetPublishers(IPublisherRepository publisherRepository) + { + var publishers = await publisherRepository.GetAllPublishers(); + if (publishers.Count() == 0) return TypedResults.NotFound($"No publishers found in the database"); + return TypedResults.Ok(publishers.Select(x => new Publisher_get(x))); + } + + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] + private static async Task GetPublisher(IPublisherRepository publisherRepository, int id) + { + var publisher = await publisherRepository.GetPublisher(id); + if (publisher == null) return TypedResults.NotFound($"No publisher with id[{id}] exists"); + return TypedResults.Ok(new Publisher_get(publisher)); + } + } +} diff --git a/exercise.webapi/Models/Book.cs b/exercise.webapi/Models/Book.cs index 9534929..55232ce 100644 --- a/exercise.webapi/Models/Book.cs +++ b/exercise.webapi/Models/Book.cs @@ -6,8 +6,9 @@ public class Book { public int Id { get; set; } public string Title { get; set; } - public int AuthorId { get; set; } public Author Author { get; set; } + public int PublisherId { get; set; } + public Publisher Publisher { get; set; } } } diff --git a/exercise.webapi/Models/Publisher.cs b/exercise.webapi/Models/Publisher.cs new file mode 100644 index 0000000..99d59e7 --- /dev/null +++ b/exercise.webapi/Models/Publisher.cs @@ -0,0 +1,11 @@ +using System.Text.Json.Serialization; + +namespace exercise.webapi.Models +{ + public class Publisher + { + public int Id { get; set; } + public string Name { get; set; } + public ICollection Books { get; set; } = new List(); + } +} diff --git a/exercise.webapi/Program.cs b/exercise.webapi/Program.cs index 43dec56..58e9cef 100644 --- a/exercise.webapi/Program.cs +++ b/exercise.webapi/Program.cs @@ -11,6 +11,8 @@ builder.Services.AddSwaggerGen(); builder.Services.AddDbContext(opt => opt.UseInMemoryDatabase("Library")); builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); var app = builder.Build(); @@ -25,8 +27,11 @@ { app.UseSwagger(); app.UseSwaggerUI(); + } app.UseHttpsRedirection(); app.ConfigureBooksApi(); +app.ConfigureAuthorsApi(); +app.ConfigurePublisherApi(); app.Run(); diff --git a/exercise.webapi/Repository/AuthorRepository.cs b/exercise.webapi/Repository/AuthorRepository.cs new file mode 100644 index 0000000..a288839 --- /dev/null +++ b/exercise.webapi/Repository/AuthorRepository.cs @@ -0,0 +1,35 @@ +using exercise.webapi.Data; +using exercise.webapi.Models; +using Microsoft.EntityFrameworkCore; + +namespace exercise.webapi.Repository +{ + public class AuthorRepository : IAuthorRepository + { + DataContext _db; + + public AuthorRepository(DataContext db) + { + _db = db; + } + + public async Task> GetAllAuthors() + { + return await _db.Authors.Include(b => b.Books).ThenInclude(b => b.Publisher).ToListAsync(); + } + + public async Task GetAuthor(int id) + { + return await _db.Authors.Include(b => b.Books).ThenInclude(b => b.Publisher).Where(b => b.Id == id).FirstOrDefaultAsync(); + } + + public async Task AddAuthorBook(int id, Book book) + { + var author = await _db.Authors.Include(b => b.Books).ThenInclude(b => b.Publisher).Where(b => b.Id == id).FirstOrDefaultAsync(); + author.Books.Add(book); + await _db.SaveChangesAsync(); + return author; + } + + } +} diff --git a/exercise.webapi/Repository/BookRepository.cs b/exercise.webapi/Repository/BookRepository.cs index 1f5e64a..e001395 100644 --- a/exercise.webapi/Repository/BookRepository.cs +++ b/exercise.webapi/Repository/BookRepository.cs @@ -1,6 +1,8 @@ using exercise.webapi.Data; +using exercise.webapi.DTO; using exercise.webapi.Models; using Microsoft.EntityFrameworkCore; +using static System.Reflection.Metadata.BlobBuilder; namespace exercise.webapi.Repository { @@ -13,10 +15,46 @@ public BookRepository(DataContext db) _db = db; } + public async Task CreateBook(string Title,int AuthorId,Author Author, int PublisherId, Publisher Publisher) + { + Book b = new Book(); + b.Author = Author; + b.Title = Title; + b.AuthorId = AuthorId; + b.Author = Author; + b.Publisher = Publisher; + + await _db.Books.AddAsync(b); + await _db.SaveChangesAsync(); + + return b; + } + + public async Task DeleteBook(int id) + { + var b = await _db.Books.Include(b => b.Author).Include(b => b.Publisher).Where(b => b.Id == id).FirstOrDefaultAsync(); + _db.Remove(b); + await _db.SaveChangesAsync(); + return b; + } + public async Task> GetAllBooks() { - return await _db.Books.Include(b => b.Author).ToListAsync(); + var books = await _db.Books.Include(p => p.Publisher).Include(b => b.Author).ToListAsync(); + return books; + } + + public async Task GetBook(int id) + { + return await _db.Books.Include(b => b.Author).Include(b => b.Publisher).Where(b => b.Id == id).FirstOrDefaultAsync(); + } + public async Task UpdateBook(int id, Author Author) + { + Book b = await GetBook(id); + b.Author = Author; + await _db.SaveChangesAsync(); + return b; } } } diff --git a/exercise.webapi/Repository/IAuthorRepository.cs b/exercise.webapi/Repository/IAuthorRepository.cs new file mode 100644 index 0000000..96d7984 --- /dev/null +++ b/exercise.webapi/Repository/IAuthorRepository.cs @@ -0,0 +1,13 @@ +using System.Security; +using exercise.webapi.Models; + +namespace exercise.webapi.Repository +{ + public interface IAuthorRepository + { + Task> GetAllAuthors(); + Task GetAuthor(int id); + Task AddAuthorBook(int id, Book book); + + } +} diff --git a/exercise.webapi/Repository/IBookRepository.cs b/exercise.webapi/Repository/IBookRepository.cs index f860016..ea29aff 100644 --- a/exercise.webapi/Repository/IBookRepository.cs +++ b/exercise.webapi/Repository/IBookRepository.cs @@ -1,9 +1,14 @@ -using exercise.webapi.Models; +using exercise.webapi.DTO; +using exercise.webapi.Models; namespace exercise.webapi.Repository { public interface IBookRepository { public Task> GetAllBooks(); + public Task GetBook(int id); + public Task UpdateBook(int id, Author Author); + public Task DeleteBook(int id); + public Task CreateBook(string Title, int AuthorId, Author Author, int PublisherId, Publisher Publisher); } } diff --git a/exercise.webapi/Repository/IPublisherRepository.cs b/exercise.webapi/Repository/IPublisherRepository.cs new file mode 100644 index 0000000..2a7fac1 --- /dev/null +++ b/exercise.webapi/Repository/IPublisherRepository.cs @@ -0,0 +1,11 @@ +using exercise.webapi.Models; + +namespace exercise.webapi.Repository +{ + public interface IPublisherRepository + { + Task> GetAllPublishers(); + Task GetPublisher(int id); + Task AddPublisherBook(int id, Book book); + } +} diff --git a/exercise.webapi/Repository/PublisherRepository.cs b/exercise.webapi/Repository/PublisherRepository.cs new file mode 100644 index 0000000..bad5198 --- /dev/null +++ b/exercise.webapi/Repository/PublisherRepository.cs @@ -0,0 +1,34 @@ +using exercise.webapi.Data; +using exercise.webapi.Models; +using Microsoft.EntityFrameworkCore; + +namespace exercise.webapi.Repository +{ + public class PublisherRepository : IPublisherRepository + { + DataContext _db; + + public PublisherRepository(DataContext db) + { + _db = db; + } + + public async Task> GetAllPublishers() + { + return await _db.Publishers.Include(b => b.Books).ThenInclude(a => a.Author).ToListAsync(); + } + + public async Task GetPublisher(int id) + { + return await _db.Publishers.Include(b => b.Books).ThenInclude(a => a.Author).Where(b => b.Id == id).FirstOrDefaultAsync(); + } + + public async Task AddPublisherBook(int id, Book book) + { + var publisher = await _db.Publishers.Include(b => b.Books).Where(b => b.Id == id).FirstOrDefaultAsync(); + publisher.Books.Add(book); + await _db.SaveChangesAsync(); + return publisher; + } + } +} diff --git a/exercise.webapi/appsettings.json b/exercise.webapi/appsettings.json index 63d13d3..8d7bd6a 100644 --- a/exercise.webapi/appsettings.json +++ b/exercise.webapi/appsettings.json @@ -7,8 +7,8 @@ }, "AllowedHosts": "*", - "ConnectionStrings": { - "DefaultConnectionString": "Host=ep-winter-silence-a8e5oju7.eastus2.azure.neon.tech; Database=neondb; Username=neondb_owner; Password=npg_nBmYdDo0Lr3z;" + "ConnectionStrings": { + "DefaultConnectionString": "Host=localhost:5432; Database=entity_framework_intro; Username=postgres; Password=123;" - } + } } \ No newline at end of file diff --git a/exercise.webapi/exercise.webapi.csproj b/exercise.webapi/exercise.webapi.csproj index 0ff4269..ec8316d 100644 --- a/exercise.webapi/exercise.webapi.csproj +++ b/exercise.webapi/exercise.webapi.csproj @@ -9,9 +9,14 @@ - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - +