using Back.Data.Contracts;
using Back.Data.Models;
using Microsoft.EntityFrameworkCore;
using Shared.DTOs;

namespace Back.Services
{
  
    public class ServPricing
    {
        private readonly IAsyncRepository<Pricing> _repoPricing;

        public ServPricing(IAsyncRepository<Pricing> repoPricing)
        {
            _repoPricing = repoPricing;
        }
        public async Task<List<PricingDto>> GetPricing()
        {
          return await  _repoPricing.GetAll()
                .Select(s=>new PricingDto
                {
                    PermissionID = s.PermissionID,
                    PermissionTitle=s.Permission.Title,
                    Price = s.Price,
                }).ToListAsync();
        }
    }
}
