From be5f388fa1a5e0cb081154541d404f2c127f8150 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 8 Mar 2017 22:33:31 -0500 Subject: [PATCH] cycle takes parameters --- src/Core/Models/StaticStore/Plan.cs | 2 +- .../Services/Implementations/OrganizationService.cs | 2 +- src/Core/Utilities/StaticStore.cs | 10 ++-------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Core/Models/StaticStore/Plan.cs b/src/Core/Models/StaticStore/Plan.cs index 4bcbb11b23..1c3baaed4b 100644 --- a/src/Core/Models/StaticStore/Plan.cs +++ b/src/Core/Models/StaticStore/Plan.cs @@ -9,7 +9,7 @@ namespace Bit.Core.Models.StaticStore public short MaxUsers { get; set; } public decimal Price { get; set; } public TimeSpan? Trial { get; set; } - public Func Cycle { get; set; } + public Func Cycle { get; set; } public bool Disabled { get; set; } } } diff --git a/src/Core/Services/Implementations/OrganizationService.cs b/src/Core/Services/Implementations/OrganizationService.cs index 95cf5e1f89..55c471bddd 100644 --- a/src/Core/Services/Implementations/OrganizationService.cs +++ b/src/Core/Services/Implementations/OrganizationService.cs @@ -53,7 +53,7 @@ namespace Bit.Core.Services } else if(plan.Cycle != null) { - organization.PlanRenewalDate = DateTime.UtcNow.Add(plan.Cycle()); + organization.PlanRenewalDate = DateTime.UtcNow.Add(plan.Cycle(DateTime.UtcNow)); } await _organizationRepository.CreateAsync(organization); diff --git a/src/Core/Utilities/StaticStore.cs b/src/Core/Utilities/StaticStore.cs index 9d10328999..cdaacae55e 100644 --- a/src/Core/Utilities/StaticStore.cs +++ b/src/Core/Utilities/StaticStore.cs @@ -103,10 +103,7 @@ namespace Bit.Core.Utilities MaxUsers = 5, Price = 1, Trial = new TimeSpan(14, 0, 0, 0), - Cycle = () => { - var now = DateTime.Now; - return now.AddYears(1) - now; - } + Cycle = now => now.AddYears(1) - now }, new Plan { @@ -114,10 +111,7 @@ namespace Bit.Core.Utilities MaxUsers = 5, Price = 10, Trial = new TimeSpan(14, 0, 0, 0), - Cycle = () => { - var now = DateTime.Now; - return now.AddMonths(1) - now; - } + Cycle = now => now.AddMonths(1) - now } };