Может быть так будет лучше
This commit is contained in:
parent
9450ae2f6f
commit
1a41ad5ce3
@ -1,4 +1,5 @@
|
||||
using SushiBarContracts.BindingModels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SushiBarContracts.BindingModels;
|
||||
using SushiBarContracts.SearchModels;
|
||||
using SushiBarContracts.StoragesContracts;
|
||||
using SushiBarContracts.ViewModels;
|
||||
@ -49,17 +50,8 @@ namespace SushiBarDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new SushiBarDatabase();
|
||||
return context.Orders
|
||||
.Select(x => new OrderViewModel
|
||||
{
|
||||
Id = x.Id,
|
||||
SushiId = x.SushiId,
|
||||
Count = x.Count,
|
||||
Sum = x.Sum,
|
||||
Status = x.Status,
|
||||
DateCreate = x.DateCreate,
|
||||
DateImplement = x.DateImplement,
|
||||
SushiName = x.Sushi.SushiName
|
||||
})
|
||||
.Include(x => x.Sushi)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace SushiBarDatabaseImplement.Models
|
||||
public DateTime DateCreate { get; set; }
|
||||
public DateTime? DateImplement { get; set; }
|
||||
public int Id { get; set; }
|
||||
public virtual Sushi Sushi { get; set; }
|
||||
public Sushi Sushi { get; set; }
|
||||
|
||||
public static Order? Create(OrderBindingModel? model)
|
||||
{
|
||||
@ -59,6 +59,7 @@ namespace SushiBarDatabaseImplement.Models
|
||||
DateImplement = DateImplement,
|
||||
Id = Id,
|
||||
Status = Status,
|
||||
SushiName = Sushi.SushiName,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace SushiBarDatabaseImplement
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-D8KMQQU\SQLEXPRESS;Initial Catalog=SushiBarDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-JC256C6\SQLEXPRESS;Initial Catalog=SushiBarDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user