refactoring

This commit is contained in:
2023-06-22 10:01:27 +03:00
parent e9d4053e65
commit d549877567
116 changed files with 1216 additions and 11709 deletions
+15 -17
View File
@@ -1,32 +1,30 @@
namespace MyOffice.Web.Models.Motion
namespace MyOffice.Web.Models.AccountMotion
{
using System.ComponentModel.DataAnnotations;
using Core.Extensions;
using MyOffice.Data.Models.Motions;
using Data.Models.Accounts;
public class MotionViewModel
{
public string? Id { get; set; }
public string CategoryId { get; set; } = null!;
public string Category { get; set; } = null!;
[Required]
public string? Name { get; set; }
public bool AllowDelete { get; set; }
public string Id { get; set; } = null!;
public DateTime Date { get; set; }
public string Motion { get; set; } = null!;
public string? Description { get; set; }
public decimal Plus { get; set; }
public decimal Minus { get; set; }
}
public static class MotionViewModelExtensions
{
public static MotionViewModel ToModel(this MotionAccount input)
public static MotionViewModel ToModel(this Motion input)
{
return new MotionViewModel
{
Id = input.MotionGlobalId.ToShort(),
CategoryId = input.Category.Id.ToShort(),
Category = input.Category.Name,
Name = input.MotionGlobal.Name,
AllowDelete = !input.Motions.Any(),
Id = input.Id.ToShort(),
Date = input.DateTime,
Motion = input.Item.ItemGlobal.Name,
Description = input.Description,
Plus = input.AmountPlus,
Minus = input.AmountMinus,
};
}
}