Last active
July 15, 2020 15:04
-
-
Save MufidJamaluddin/76f7a11476812ff64acae648e68cea12 to your computer and use it in GitHub Desktop.
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 IssueTracker.Controller | |
{ | |
[Route("api/[controller]")] | |
public class TicketController : Controller | |
{ | |
private ITicketServices TicketServices { get; } | |
public TicketController(ITicketServices TicketServices) | |
{ | |
this.TicketServices = TicketServices; | |
} | |
[HttpGet] | |
[Route("ticket/{id}")] | |
[Authorize(Roles = RolePolicy.User + "," + RolePolicy.ProductOwner)] | |
public TicketVM GetOneData(string id) | |
{ | |
TicketVM data = TicketServices.GetDataById(id); | |
return data; | |
} | |
... | |
} | |
[Route("api/[controller]")] | |
public class TicketBuyerController : Controller | |
{ | |
private ITicketServices TicketServices { get; } | |
private IUserServices UserServices { get; } | |
private IPaymentServices PaymentServices { get; } | |
public TicketController( | |
ITicketServices TicketServices, | |
IUserServices UserServices, | |
IPaymentServices PaymentServices | |
) | |
{ | |
this.TicketServices = TicketServices; | |
this.UserServices = UserServices; | |
this.PaymentServices = PaymentServices; | |
} | |
... | |
} | |
} | |
namespace IssueTracker.Services | |
{ | |
public class TicketServices : ITicketServices | |
{ | |
private ITicketRepository TicketRepository { get; } | |
private ITransactionRepository TransactionRepository { get; } | |
private ILogger<TicketServices> Logger { get; } | |
public TicketServices( | |
ILogger<TicketServices> logger, | |
ITicketRepository TicketRepository, | |
ITransactionRepository TransactionRepository | |
) | |
{ | |
this.Logger = logger; | |
this.TicketRepository = TicketRepository; | |
this.TransactionRepository = TransactionRepository; | |
} | |
... | |
} | |
} | |
namespace IssueTracker.Repositories | |
{ | |
public class TicketRepository : ITicketRepository | |
{ | |
private IssueTrackerDbContext DbContext { get; } | |
public TicketServices(IssueTrackerDbContext issueTrackerDbContext) | |
{ | |
this.DbContext = issueTrackerDbContext; | |
} | |
... | |
} | |
public class PaymentRepository : IPaymentRepository | |
{ | |
private PaymentDbContext DbContext { get; } | |
public TicketServices(PaymentDbContext paymenDbContext) | |
{ | |
this.DbContext = paymenDbContext; | |
} | |
... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment