....
This commit is contained in:
27
Back/Services/ServBase.cs
Normal file
27
Back/Services/ServBase.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Back.Data.Contracts;
|
||||
using Back.Data.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Shared.DTOs;
|
||||
|
||||
namespace Back.Services
|
||||
{
|
||||
public class ServBase
|
||||
{
|
||||
private readonly IAsyncRepository<Pricing> _repoPricing;
|
||||
public ServBase(IAsyncRepository<Pricing> repoPricing)
|
||||
{
|
||||
_repoPricing = repoPricing;
|
||||
}
|
||||
public async Task<List<BasePriceDto>> GetBasePrice()
|
||||
{
|
||||
return await _repoPricing.GetAll().Select(x => new BasePriceDto
|
||||
{
|
||||
Price = x.Price,
|
||||
CalculationType = x.CalculationTypeID==1 ? "واحدی"
|
||||
: x.CalculationTypeID == 1 && x.PermissionID==16 ? "هر ارسال"
|
||||
: x.CalculationTypeID == 2 ? "نامحدود" : "روزانه",
|
||||
PermissionID=x.PermissionID,
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user