mirror of https://github.com/abpframework/abp.git
5 changed files with 67 additions and 21 deletions
@ -0,0 +1,28 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
public interface IDashboardAppService : IApplicationService |
|||
{ |
|||
Task<CountersWidgetResultDto> GetCountersWidgetAsync(CountersWidgetInputDto input); |
|||
} |
|||
|
|||
public class CountersWidgetInputDto |
|||
{ |
|||
public DateTime StartDate { get; set; } |
|||
|
|||
public DateTime EndDate { get; set; } |
|||
} |
|||
|
|||
public class CountersWidgetResultDto |
|||
{ |
|||
public int NewUsers { get; set; } |
|||
public int ActiveUsers { get; set; } |
|||
public double TotalIncome { get; set; } |
|||
public double TotalProfit { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
public class DashboardAppService : DashboardDemoAppService, IDashboardAppService |
|||
{ |
|||
public async Task<CountersWidgetResultDto> GetCountersWidgetAsync(CountersWidgetInputDto input) |
|||
{ |
|||
/* Instead of hard-coded / calculated values, get counts from a repository! |
|||
*/ |
|||
|
|||
var dayFactor = (int)Math.Round(input.EndDate.Subtract(input.StartDate).TotalDays + 1); |
|||
return new CountersWidgetResultDto |
|||
{ |
|||
NewUsers = dayFactor * 86, |
|||
ActiveUsers = dayFactor * 58, |
|||
TotalIncome = dayFactor * 749.53, |
|||
TotalProfit = dayFactor * 239.45, |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
@ -1,10 +0,0 @@ |
|||
namespace DashboardDemo.Web.Pages.Components.CountersWidget |
|||
{ |
|||
public class CountersWidgetViewModel |
|||
{ |
|||
public int NewUsers { get; set; } |
|||
public int ActiveUsers { get; set; } |
|||
public double TotalIncome { get; set; } |
|||
public double TotalProfit { get; set; } |
|||
} |
|||
} |
|||
Loading…
Reference in new issue