28 lines
880 B
C#
28 lines
880 B
C#
![]() |
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();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|