If frequency is null send all prices for all plans
This commit is contained in:
parent
c708fa1ea1
commit
545018dde1
@ -0,0 +1,21 @@
|
|||||||
|
using Marco.Pms.Model.Master;
|
||||||
|
using Marco.Pms.Model.TenantModels.MongoDBModel;
|
||||||
|
|
||||||
|
namespace Marco.Pms.Model.ViewModels.Tenant
|
||||||
|
{
|
||||||
|
public class SubscriptionPlanDetailsVM
|
||||||
|
{
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
public string? PlanName { get; set; }
|
||||||
|
public string? Description { get; set; }
|
||||||
|
public double PriceQuarterly { get; set; }
|
||||||
|
public double PriceMonthly { get; set; }
|
||||||
|
public double PriceHalfYearly { get; set; }
|
||||||
|
public double PriceYearly { get; set; }
|
||||||
|
public int TrialDays { get; set; }
|
||||||
|
public double MaxUser { get; set; }
|
||||||
|
public double MaxStorage { get; set; }
|
||||||
|
public FeatureDetails? Features { get; set; }
|
||||||
|
public CurrencyMaster? Currency { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -520,11 +520,22 @@ namespace Marco.Pms.Services.Controllers
|
|||||||
#region =================================================================== Subscription Plan APIs ===================================================================
|
#region =================================================================== Subscription Plan APIs ===================================================================
|
||||||
|
|
||||||
[HttpGet("list/subscription-plan")]
|
[HttpGet("list/subscription-plan")]
|
||||||
public async Task<IActionResult> GetSubscriptionPlanList([FromQuery] int frequency)
|
public async Task<IActionResult> GetSubscriptionPlanList([FromQuery] int? frequency)
|
||||||
{
|
{
|
||||||
await using var _context = await _dbContextFactory.CreateDbContextAsync();
|
await using var _context = await _dbContextFactory.CreateDbContextAsync();
|
||||||
var plans = await _context.SubscriptionPlans.Include(s => s.Currency).ToListAsync();
|
var plans = await _context.SubscriptionPlans.Include(s => s.Currency).ToListAsync();
|
||||||
|
|
||||||
|
if (frequency == null)
|
||||||
|
{
|
||||||
|
var detailsVM = await Task.WhenAll(plans.Select(async p =>
|
||||||
|
{
|
||||||
|
var response = _mapper.Map<SubscriptionPlanDetailsVM>(p);
|
||||||
|
response.Features = await _featureDetailsHelper.GetFeatureDetails(p.FeaturesId);
|
||||||
|
return response;
|
||||||
|
}).ToList());
|
||||||
|
|
||||||
|
return Ok(ApiResponse<object>.SuccessResponse(detailsVM, "List of plans fetched successfully", 200));
|
||||||
|
}
|
||||||
var vm = await Task.WhenAll(plans.Select(async p =>
|
var vm = await Task.WhenAll(plans.Select(async p =>
|
||||||
{
|
{
|
||||||
var response = _mapper.Map<SubscriptionPlanVM>(p);
|
var response = _mapper.Map<SubscriptionPlanVM>(p);
|
||||||
|
@ -33,6 +33,7 @@ namespace Marco.Pms.Services.MappingProfiles
|
|||||||
);
|
);
|
||||||
|
|
||||||
CreateMap<SubscriptionPlan, SubscriptionPlanVM>();
|
CreateMap<SubscriptionPlan, SubscriptionPlanVM>();
|
||||||
|
CreateMap<SubscriptionPlan, SubscriptionPlanDetailsVM>();
|
||||||
CreateMap<SubscriptionPlanDto, SubscriptionPlan>();
|
CreateMap<SubscriptionPlanDto, SubscriptionPlan>();
|
||||||
CreateMap<FeatureDetailsDto, FeatureDetails>();
|
CreateMap<FeatureDetailsDto, FeatureDetails>();
|
||||||
CreateMap<SubscriptionCheckListDto, SubscriptionCheckList>();
|
CreateMap<SubscriptionCheckListDto, SubscriptionCheckList>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user