This commit is contained in:
2023-06-17 14:16:09 +03:00
parent 62178f1f32
commit 7ae5d3bc81
180 changed files with 12932 additions and 192 deletions
@@ -0,0 +1,19 @@
namespace MyOffice.Web.Models.Currency
{
public class CurrencyAddModel
{
public string Id { get; set; } = null!;
public string Name { get; set; } = null!;
public string ShortName { get; set; } = null!;
public int Quantity { get; set; }
public decimal Rate { get; set; }
public DateTime RateDate { get; set; }
}
public class CurrencyRateModel
{
public int Quantity { get; set; }
public decimal Rate { get; set; }
public DateTime RateDate { get; set; }
}
}
@@ -0,0 +1,27 @@
namespace MyOffice.Web.Models.Currency
{
using Data.Models.Currencies;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
public class CurrencyGlobalViewModel
{
public string Id { get; set; } = null!;
public string Name { get; set; } = null!;
public int Quantity { get; set; }
public string Symbol { get; set; } = null!;
}
public static class CurrencyGlobalViewModelExtensions
{
public static CurrencyGlobalViewModel ToModel(this CurrencyGlobal input)
{
return new CurrencyGlobalViewModel
{
Id = input.Id,
Name = input.Name,
Quantity = input.DefaultQuantity,
Symbol = input.Symbol,
};
}
}
}
@@ -0,0 +1,32 @@
namespace MyOffice.Web.Models.Currency
{
using Core.Extensions;
using Data.Models.Currencies;
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
public class CurrencyViewModel
{
public string Id { get; set; } = null!;
public string Code { get; set; } = null!;
public string Name { get; set; } = null!;
public decimal? Rate { get; set; }
public int? Quantity { get; set; }
public DateTime? RateDate { get; set; }
}
public static class CurrencyViewModelExtensions
{
public static CurrencyViewModel ToModel(this Currency input, CurrencyRate? rate = null)
{
return new CurrencyViewModel
{
Id = input.Id.ToShort(),
Code = input.CurrencyGlobal!.Id,
Name = input.Name,
Quantity = rate?.Quantity,
Rate = rate?.Rate,
RateDate = rate?.DateTime,
};
}
}
}