This file contains hidden or 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 interface ICatalogueRepository:IGenericRepository<Catalogue> | |
| { | |
| } |
This file contains hidden or 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 interface IGenericRepository<T> where T : class | |
| { | |
| Task<T> Get(int id); | |
| Task<IEnumerable<T>> GetAll(); | |
| Task<int> Add(T entity); | |
| Task<int> Delete(int id); | |
| Task<int> Update(T entity); | |
| } |
This file contains hidden or 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 interface ICatalogueRepository | |
| { | |
| Task<Catalogue> Get(int id); | |
| Task<IEnumerable<Catalogue>> GetAll(); | |
| Task<int> Add(Catalogue entity); | |
| Task<bool> Delete(int id); | |
| Task<bool> Update(Catalogue catalogueEntity); | |
| } |
This file contains hidden or 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 interface IBooksRepository | |
| { | |
| Task<Book> Get(int id); | |
| Task<IEnumerable<Book>> GetAll(); | |
| Task<int> Add(Book entity); | |
| Task<bool> Delete(int id); | |
| Task<bool> Update(Book bookEntity); | |
| } |
This file contains hidden or 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.Collections.Generic; | |
| using BookStore.Domain.BooksAggregate; | |
| namespace BookStore.Domain.CatalogueAggregate | |
| { | |
| public class Catalogue | |
| { | |
| public int CatalogueId { get; set; } | |
| public string Name { get; set; } | |
| public List<Book> Books { get; set; } |
This file contains hidden or 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 BookStore.Domain.BooksAggregate | |
| { | |
| public class Book | |
| { | |
| public int Id { get; set; } | |
| public string Title { get; set; } | |
| public string Author { get; set; } | |
| public string Publisher { get; set; } | |
| public string Genre { get; set; } | |
| public int Price { get; set; } |
This file contains hidden or 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 void ConfigureServices(IServiceCollection services) | |
| { | |
| AddCORS(services); | |
| AddSwagger(services); | |
| services.AddMediatR(Assembly.GetExecutingAssembly()); | |
| services.AddTransient(typeof(IPipelineBehavior<,>), typeof(LoggingBehaviour<,>)); | |
| services.AddControllers(); | |
| } |
This file contains hidden or 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
| dotnet add package Mediatr | |
| dotnet add package MediatR.Extensions.Microsoft.DependencyInjection |
This file contains hidden or 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
| services.AddHttpClient<ICandidateService, CandidateService>(client => | |
| { | |
| client.BaseAddress = new Uri("https://localhost:5001"), | |
| client.DefaultRequestVersion = new Version(2, 0) | |
| }); |
This file contains hidden or 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
| var client = new HttpClient() | |
| { | |
| BaseAddress = new Uri("https://localhost:5001"), | |
| DefaultRequestVersion = new Version(2, 0) | |
| }; |