This commit is contained in:
2023-07-21 21:06:45 +03:00
parent 2f108bef4f
commit fa5a8a9001
37 changed files with 2319 additions and 28 deletions
@@ -75,7 +75,7 @@ public class CurrencyController : BaseApiController
var exec = _currencyService.CurrencyUpdate(
UserId,
id.AsGuid(),
new CurrencyEdit { Name = currency.Name, ShortName = currency.ShortName }
new CurrencyEdit { Name = currency.Name, ShortName = currency.ShortName, IsPrimary = currency.IsPrimary }
);
switch (exec.Status)
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using MyOffice.Services.Account;
using MyOffice.Services.Item;
using Services.Dashboard;
[Authorize]
[ApiController]
@@ -11,24 +12,23 @@ using MyOffice.Services.Item;
public class DashboardController : BaseApiController
{
private readonly ILogger<DashboardController> _logger;
private readonly DashboardService _dashboardService;
public DashboardController(
ILogger<DashboardController> logger
ILogger<DashboardController> logger,
DashboardService dashboardService
)
{
_logger = logger;
_dashboardService = dashboardService;
}
[HttpGet("~/api/accounts")]
[HttpGet("~/api/dashboard")]
public object Index()
{
return new
{
IncomeLastWeek = 100m,
IncomePreviousWeek = 100m,
OutcomeLastWeek = 100m,
OutcomePreviousWeek = 100m,
};
var data = _dashboardService.GetDashboardRestData(UserId);
return data;
}
}
@@ -7,4 +7,5 @@ public class CurrencyEditModel
public int Quantity { get; set; }
public decimal Rate { get; set; }
public DateTime RateDate { get; set; }
public bool IsPrimary { get; set; }
}
@@ -14,6 +14,7 @@
public decimal? Rate { get; set; }
public int? Quantity { get; set; }
public DateTime? RateDate { get; set; }
public bool IsPrimary { get; set; }
}
public static class CurrencyViewModelExtensions
@@ -30,6 +31,7 @@
Quantity = rate?.Quantity,
Rate = rate?.Rate,
RateDate = rate?.DateTime,
IsPrimary = input.IsPrimary,
};
}
}
+2
View File
@@ -40,6 +40,7 @@ using IdentityServer4.Services;
using MyOffice.Services.Currency;
using Services.Account;
using Services.Item;
using MyOffice.Services.Dashboard;
public class Program
{
@@ -229,6 +230,7 @@ public class Program
builder.Services.AddScoped<CurrencyService, CurrencyService>();
builder.Services.AddScoped<AccountService, AccountService>();
builder.Services.AddScoped<ItemService, ItemService>();
builder.Services.AddScoped<DashboardService, DashboardService>();
}
private static readonly ConcurrentDictionary<string, PhysicalFileInfo> _staticFilesCache = new();