1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-28 23:04:50 -05:00

cycle takes parameters

This commit is contained in:
Kyle Spearrin 2017-03-08 22:33:31 -05:00
parent 8bcd4e0463
commit be5f388fa1
3 changed files with 4 additions and 10 deletions

View File

@ -9,7 +9,7 @@ namespace Bit.Core.Models.StaticStore
public short MaxUsers { get; set; } public short MaxUsers { get; set; }
public decimal Price { get; set; } public decimal Price { get; set; }
public TimeSpan? Trial { get; set; } public TimeSpan? Trial { get; set; }
public Func<TimeSpan> Cycle { get; set; } public Func<DateTime, TimeSpan> Cycle { get; set; }
public bool Disabled { get; set; } public bool Disabled { get; set; }
} }
} }

View File

@ -53,7 +53,7 @@ namespace Bit.Core.Services
} }
else if(plan.Cycle != null) 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); await _organizationRepository.CreateAsync(organization);

View File

@ -103,10 +103,7 @@ namespace Bit.Core.Utilities
MaxUsers = 5, MaxUsers = 5,
Price = 1, Price = 1,
Trial = new TimeSpan(14, 0, 0, 0), Trial = new TimeSpan(14, 0, 0, 0),
Cycle = () => { Cycle = now => now.AddYears(1) - now
var now = DateTime.Now;
return now.AddYears(1) - now;
}
}, },
new Plan new Plan
{ {
@ -114,10 +111,7 @@ namespace Bit.Core.Utilities
MaxUsers = 5, MaxUsers = 5,
Price = 10, Price = 10,
Trial = new TimeSpan(14, 0, 0, 0), Trial = new TimeSpan(14, 0, 0, 0),
Cycle = () => { Cycle = now => now.AddMonths(1) - now
var now = DateTime.Now;
return now.AddMonths(1) - now;
}
} }
}; };