mirror of
https://github.com/D4M13N-D3V/comissions-app-core-api.git
synced 2025-03-14 10:04:55 +00:00
fix: added endpoint to get the service by id
This commit is contained in:
parent
1d02758d71
commit
0a05137b81
@ -163,6 +163,24 @@ public class DiscoveryController : Controller
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("Sellers/{sellerId:int}/Services/{serviceId:int}")]
|
||||
public async Task<IActionResult> GetSellerService(int sellerId, int serviceId)
|
||||
{
|
||||
var seller = await _dbContext.UserSellerProfiles
|
||||
.Include(x=>x.User)
|
||||
.FirstOrDefaultAsync(x=>x.Id==sellerId);
|
||||
if(seller==null)
|
||||
return NotFound("Seller not found.");
|
||||
var sellerService = await _dbContext.SellerServices
|
||||
.Include(x=>x.Reviews)
|
||||
.FirstOrDefaultAsync(x=>x.Id==serviceId);
|
||||
if(sellerService==null)
|
||||
return NotFound("Seller service not found.");
|
||||
var result = sellerService.ToModel();
|
||||
return Ok(result);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("Sellers/{sellerId:int}/Services/Count")]
|
||||
public async Task<IActionResult> GetSellerServicesCount(int sellerId)
|
||||
|
Loading…
x
Reference in New Issue
Block a user