Compare commits
15 Commits
0e351cdabe
...
851b151d03
Author | SHA1 | Date | |
---|---|---|---|
851b151d03 | |||
cb681bb79e | |||
3e8b6586d3 | |||
5e5d85698b | |||
b3c2b05c5b | |||
8507a11132 | |||
716e94751c | |||
b2c61a619a | |||
862baf93b6 | |||
daf95e27b6 | |||
75a544e690 | |||
e390ece7b6 | |||
9c80b7fd37 | |||
49152e95c5 | |||
ccfe49dde9 |
@ -103,7 +103,6 @@ namespace LawFirmView
|
||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
||||
{
|
||||
DocumentId = Convert.ToInt32(comboBoxDocument.SelectedValue),
|
||||
DocumentName = comboBoxDocument.Text,
|
||||
Count = Convert.ToInt32(textBoxCount.Text),
|
||||
Sum = Convert.ToDouble(textBoxSum.Text)
|
||||
});
|
||||
|
@ -59,7 +59,6 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
{
|
||||
Id = viewModel.Id,
|
||||
DocumentId = viewModel.DocumentId,
|
||||
DocumentName = viewModel.DocumentName,
|
||||
Status = viewModel.Status,
|
||||
DateCreate = viewModel.DateCreate,
|
||||
DateImplement = viewModel.DateImplement,
|
||||
@ -67,7 +66,7 @@ namespace LawFirmBusinessLogic.BusinessLogics
|
||||
Sum = viewModel.Sum
|
||||
};
|
||||
|
||||
CheckModel(model);
|
||||
CheckModel(model, false);
|
||||
if (model.Status + 1 != newStatus)
|
||||
{
|
||||
_logger.LogWarning("Status update to " + newStatus.ToString() +" operation failed. Order status incorrect.");
|
||||
|
@ -12,8 +12,6 @@ namespace LawFirmContracts.BindingModels
|
||||
{
|
||||
public int DocumentId { get; set; }
|
||||
|
||||
public string DocumentName { get; set; } = string.Empty;
|
||||
|
||||
public int Count { get; set; }
|
||||
|
||||
public double Sum { get; set; }
|
||||
|
@ -10,7 +10,6 @@ namespace LawFirmDataModels.Models
|
||||
public interface IOrderModel : IId
|
||||
{
|
||||
int DocumentId { get; }
|
||||
string DocumentName { get; }
|
||||
int Count { get; }
|
||||
double Sum { get; }
|
||||
OrderStatus Status { get; }
|
||||
|
@ -3,6 +3,7 @@ using LawFirmContracts.SearchModels;
|
||||
using LawFirmContracts.StorageContracts;
|
||||
using LawFirmContracts.ViewModels;
|
||||
using LawFirmDatabaseImplement.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -20,7 +21,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
return null;
|
||||
}
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Orders.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
return context.Orders.Include(x => x.Document).FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
@ -32,6 +33,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Orders
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Include(x => x.Document)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -39,7 +41,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
public List<OrderViewModel> GetFullList()
|
||||
{
|
||||
using var context = new LawFirmDatabase();
|
||||
return context.Orders.Select(x => x.GetViewModel).ToList();
|
||||
return context.Orders.Include(x => x.Document).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public OrderViewModel? Insert(OrderBindingModel model)
|
||||
@ -52,7 +54,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
using var context = new LawFirmDatabase();
|
||||
context.Orders.Add(newOrder);
|
||||
context.SaveChanges();
|
||||
return newOrder.GetViewModel;
|
||||
return context.Orders.Include(x => x.Document).FirstOrDefault(x => x.Id == newOrder.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
@ -65,7 +67,7 @@ namespace LawFirmDatabaseImplement.Implements
|
||||
}
|
||||
order.Update(model);
|
||||
context.SaveChanges();
|
||||
return order.GetViewModel;
|
||||
return context.Orders.Include(x => x.Document).FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
public OrderViewModel? Delete(OrderBindingModel model)
|
||||
{
|
||||
|
171
LawFirm/LawFirmDatabaseImplement/Migrations/20230310164628_OrderFix.Designer.cs
generated
Normal file
171
LawFirm/LawFirmDatabaseImplement/Migrations/20230310164628_OrderFix.Designer.cs
generated
Normal file
@ -0,0 +1,171 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using LawFirmDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LawFirmDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(LawFirmDatabase))]
|
||||
[Migration("20230310164628_OrderFix")]
|
||||
partial class OrderFix
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Blank", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("BlankName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Blanks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Document", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("DocumentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Documents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.DocumentBlank", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("BlankId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DocumentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("BlankId");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.ToTable("DocumentBlanks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DocumentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DocumentId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.DocumentBlank", b =>
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Blank", "Blank")
|
||||
.WithMany("DocumentBlanks")
|
||||
.HasForeignKey("BlankId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Document", "Document")
|
||||
.WithMany("Blanks")
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Blank");
|
||||
|
||||
b.Navigation("Document");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Document", "Document")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Blank", b =>
|
||||
{
|
||||
b.Navigation("DocumentBlanks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Document", b =>
|
||||
{
|
||||
b.Navigation("Blanks");
|
||||
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace LawFirmDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class OrderFix : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DocumentName",
|
||||
table: "Orders");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "DocumentName",
|
||||
table: "Orders",
|
||||
type: "nvarchar(max)",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
}
|
||||
}
|
||||
}
|
@ -108,10 +108,6 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
b.Property<int>("DocumentId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DocumentName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
@ -146,11 +142,13 @@ namespace LawFirmDatabaseImplement.Migrations
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Document", null)
|
||||
b.HasOne("LawFirmDatabaseImplement.Models.Document", "Document")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("DocumentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Document");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("LawFirmDatabaseImplement.Models.Blank", b =>
|
||||
|
@ -39,6 +39,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
[ForeignKey("DocumentId")]
|
||||
public virtual List<Order> Orders { get; set; } = new();
|
||||
|
||||
|
||||
public static Document? Create(LawFirmDatabase context, DocumentBindingModel model)
|
||||
{
|
||||
return new Document()
|
||||
|
@ -16,8 +16,6 @@ namespace LawFirmDatabaseImplement.Models
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public int DocumentId { get; private set; }
|
||||
|
||||
public string DocumentName { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public int Count { get; private set; }
|
||||
[Required]
|
||||
@ -28,6 +26,7 @@ namespace LawFirmDatabaseImplement.Models
|
||||
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
||||
|
||||
public DateTime? DateImplement { get; private set; }
|
||||
public virtual Document Document { get; set; }
|
||||
|
||||
public static Order? Create(OrderBindingModel? model)
|
||||
{
|
||||
@ -38,7 +37,6 @@ namespace LawFirmDatabaseImplement.Models
|
||||
return new Order
|
||||
{
|
||||
DocumentId = model.DocumentId,
|
||||
DocumentName = model.DocumentName,
|
||||
Count = model.Count,
|
||||
Sum = model.Sum,
|
||||
Status = model.Status,
|
||||
@ -54,26 +52,20 @@ namespace LawFirmDatabaseImplement.Models
|
||||
{
|
||||
return;
|
||||
}
|
||||
DocumentId = model.DocumentId;
|
||||
DocumentName = model.DocumentName;
|
||||
Count = model.Count;
|
||||
Sum = model.Sum;
|
||||
Status = model.Status;
|
||||
DateCreate = model.DateCreate;
|
||||
DateImplement = model.DateImplement;
|
||||
Id = model.Id;
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
DocumentId = DocumentId,
|
||||
DocumentName = DocumentName,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
DateCreate = DateCreate,
|
||||
DateImplement = DateImplement,
|
||||
Id = Id,
|
||||
Status = Status,
|
||||
DocumentName = Document.DocumentName
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ namespace LawFirmFileImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
blank.Update(model);
|
||||
source.Blanks.Remove(blank);
|
||||
source.SaveBlanks();
|
||||
return blank.GetViewModel;
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ namespace LawFirmFileImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
document.Update(model);
|
||||
source.Documents.Remove(document);
|
||||
source.SaveDocuments();
|
||||
return document.GetViewModel;
|
||||
}
|
||||
|
@ -26,8 +26,8 @@ namespace LawFirmFileImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return source.Orders
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
return GetViewModel(source.Orders
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id)));
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
@ -38,13 +38,13 @@ namespace LawFirmFileImplement.Implements
|
||||
}
|
||||
return source.Orders
|
||||
.Where(x => x.Id == model.Id)
|
||||
.Select(x => x.GetViewModel)
|
||||
.Select(x => GetViewModel(x))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFullList()
|
||||
{
|
||||
return source.Orders.Select(x => x.GetViewModel).ToList();
|
||||
return source.Orders.Select(x => GetViewModel(x)).ToList();
|
||||
}
|
||||
|
||||
public OrderViewModel? Insert(OrderBindingModel model)
|
||||
@ -57,7 +57,7 @@ namespace LawFirmFileImplement.Implements
|
||||
}
|
||||
source.Orders.Add(newOrder);
|
||||
source.SaveOrders();
|
||||
return newOrder.GetViewModel;
|
||||
return GetViewModel(newOrder);
|
||||
}
|
||||
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
@ -69,7 +69,7 @@ namespace LawFirmFileImplement.Implements
|
||||
}
|
||||
order.Update(model);
|
||||
source.SaveOrders();
|
||||
return order.GetViewModel;
|
||||
return GetViewModel(order);
|
||||
}
|
||||
public OrderViewModel? Delete(OrderBindingModel model)
|
||||
{
|
||||
@ -78,9 +78,23 @@ namespace LawFirmFileImplement.Implements
|
||||
{
|
||||
return null;
|
||||
}
|
||||
order.Update(model);
|
||||
source.Orders.Remove(order);
|
||||
source.SaveOrders();
|
||||
return order.GetViewModel;
|
||||
return GetViewModel(order);
|
||||
}
|
||||
|
||||
private OrderViewModel GetViewModel(Order order)
|
||||
{
|
||||
var viewModel = order.GetViewModel;
|
||||
foreach (var document in source.Documents)
|
||||
{
|
||||
if (document.Id == order.DocumentId)
|
||||
{
|
||||
viewModel.DocumentName = document.DocumentName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -15,8 +15,6 @@ namespace LawFirmFileImplement.Models
|
||||
{
|
||||
public int DocumentId { get; private set; }
|
||||
|
||||
public string DocumentName { get; private set; } = string.Empty;
|
||||
|
||||
public int Count { get; private set; }
|
||||
|
||||
public double Sum { get; private set; }
|
||||
@ -38,7 +36,6 @@ namespace LawFirmFileImplement.Models
|
||||
return new Order
|
||||
{
|
||||
DocumentId = model.DocumentId,
|
||||
DocumentName = model.DocumentName,
|
||||
Count = model.Count,
|
||||
Sum = model.Sum,
|
||||
Status = model.Status,
|
||||
@ -57,7 +54,6 @@ namespace LawFirmFileImplement.Models
|
||||
return new Order()
|
||||
{
|
||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||
DocumentName = element.Element("DocumentName")!.Value,
|
||||
DocumentId = Convert.ToInt32(element.Element("DocumentId")!.Value),
|
||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||
@ -73,20 +69,13 @@ namespace LawFirmFileImplement.Models
|
||||
{
|
||||
return;
|
||||
}
|
||||
DocumentId = model.DocumentId;
|
||||
DocumentName = model.DocumentName;
|
||||
Count = model.Count;
|
||||
Sum = model.Sum;
|
||||
Status = model.Status;
|
||||
DateCreate = model.DateCreate;
|
||||
DateImplement = model.DateImplement;
|
||||
Id = model.Id;
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
DocumentId = DocumentId,
|
||||
DocumentName = DocumentName,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
DateCreate = DateCreate,
|
||||
@ -98,7 +87,6 @@ namespace LawFirmFileImplement.Models
|
||||
public XElement GetXElement => new(
|
||||
"Order",
|
||||
new XAttribute("Id", Id),
|
||||
new XElement("DocumentName", DocumentName),
|
||||
new XElement("DocumentId", DocumentId.ToString()),
|
||||
new XElement("Count", Count.ToString()),
|
||||
new XElement("Sum", Sum.ToString()),
|
||||
|
@ -30,7 +30,7 @@ namespace LawFirmListImplements.Implements
|
||||
{
|
||||
if (model.Id.HasValue && order.Id == model.Id)
|
||||
{
|
||||
return order.GetViewModel;
|
||||
return GetViewModel(order);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -47,7 +47,7 @@ namespace LawFirmListImplements.Implements
|
||||
{
|
||||
if (order.Id == model.Id)
|
||||
{
|
||||
result.Add(order.GetViewModel);
|
||||
result.Add(GetViewModel(order));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -58,7 +58,7 @@ namespace LawFirmListImplements.Implements
|
||||
var result = new List<OrderViewModel>();
|
||||
foreach (var order in _source.Orders)
|
||||
{
|
||||
result.Add(order.GetViewModel);
|
||||
result.Add(GetViewModel(order));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -79,7 +79,7 @@ namespace LawFirmListImplements.Implements
|
||||
return null;
|
||||
}
|
||||
_source.Orders.Add(newOrder);
|
||||
return newOrder.GetViewModel;
|
||||
return GetViewModel(newOrder);
|
||||
}
|
||||
|
||||
public OrderViewModel? Update(OrderBindingModel model)
|
||||
@ -89,7 +89,7 @@ namespace LawFirmListImplements.Implements
|
||||
if (order.Id == model.Id)
|
||||
{
|
||||
order.Update(model);
|
||||
return order.GetViewModel;
|
||||
return GetViewModel(order);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -102,11 +102,25 @@ namespace LawFirmListImplements.Implements
|
||||
{
|
||||
var element = _source.Orders[i];
|
||||
_source.Orders.RemoveAt(i);
|
||||
return element.GetViewModel;
|
||||
return GetViewModel(element);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private OrderViewModel GetViewModel(Order order)
|
||||
{
|
||||
var viewModel = order.GetViewModel;
|
||||
foreach (var document in _source.Documents)
|
||||
{
|
||||
if (document.Id == order.DocumentId)
|
||||
{
|
||||
viewModel.DocumentName = document.DocumentName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,6 @@ namespace LawFirmListImplements.Models
|
||||
{
|
||||
public int DocumentId { get; private set; }
|
||||
|
||||
public string DocumentName { get; private set; } = string.Empty;
|
||||
|
||||
public int Count { get; private set; }
|
||||
|
||||
public double Sum { get; private set; }
|
||||
@ -37,7 +35,6 @@ namespace LawFirmListImplements.Models
|
||||
return new Order
|
||||
{
|
||||
DocumentId = model.DocumentId,
|
||||
DocumentName = model.DocumentName,
|
||||
Count = model.Count,
|
||||
Sum = model.Sum,
|
||||
Status = model.Status,
|
||||
@ -53,20 +50,13 @@ namespace LawFirmListImplements.Models
|
||||
{
|
||||
return;
|
||||
}
|
||||
DocumentId = model.DocumentId;
|
||||
DocumentName = model.DocumentName;
|
||||
Count = model.Count;
|
||||
Sum = model.Sum;
|
||||
Status = model.Status;
|
||||
DateCreate = model.DateCreate;
|
||||
DateImplement = model.DateImplement;
|
||||
Id = model.Id;
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
DocumentId = DocumentId,
|
||||
DocumentName = DocumentName,
|
||||
Count = Count,
|
||||
Sum = Sum,
|
||||
DateCreate = DateCreate,
|
||||
|
Loading…
Reference in New Issue
Block a user