частичная реализация BuildStorage
This commit is contained in:
parent
61d8d1170b
commit
aac6acd899
@ -1,5 +1,4 @@
|
||||
using HardwareShopDataModels.Models;
|
||||
using HardwareShopDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
namespace HardwareShopContracts.BindingModels
|
||||
{
|
||||
|
@ -1,5 +1,4 @@
|
||||
using HardwareShopDataModels.Models;
|
||||
using HardwareShopDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HardwareShopContracts.BindingModels
|
||||
|
@ -1,6 +1,5 @@
|
||||
using HardwareShopDataModels.Enums;
|
||||
using HardwareShopDataModels.Models;
|
||||
using HardwareShopDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
namespace HardwareShopContracts.BindingModels
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ namespace HardwareShopContracts.StoragesContracts
|
||||
public interface IBuildStorage
|
||||
{
|
||||
List<BuildViewModel> GetFullList();
|
||||
List<BuildViewModel> GetFilteredList(BuildSearchModel model);
|
||||
List<BuildViewModel> GetFilteredList(UserSearchModel model);
|
||||
BuildViewModel? GetElement(BuildSearchModel model);
|
||||
BuildViewModel? Insert(BuildBindingModel model);
|
||||
BuildViewModel? Update(BuildBindingModel model);
|
||||
|
@ -21,7 +21,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Implements\" />
|
||||
<Folder Include="Implements\Storekeeper\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -0,0 +1,21 @@
|
||||
using HardwareShopContracts.BindingModels;
|
||||
using HardwareShopContracts.SearchModels;
|
||||
using HardwareShopContracts.ViewModels;
|
||||
|
||||
namespace HardwareShopContracts.StoragesContracts
|
||||
{
|
||||
public interface IUsertorage
|
||||
{
|
||||
List<UserViewModel> GetFullList();
|
||||
|
||||
List<UserViewModel> GetFilteredList(UserSearchModel model);
|
||||
|
||||
UserViewModel? GetElement(UserSearchModel model);
|
||||
|
||||
UserViewModel? Insert(UserBindingModel model);
|
||||
|
||||
UserViewModel? Update(UserBindingModel model);
|
||||
|
||||
UserViewModel? Delete(UserBindingModel model);
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
using HardwareShopContracts.BindingModels;
|
||||
using HardwareShopContracts.SearchModels;
|
||||
using HardwareShopContracts.ViewModels;
|
||||
using HardwareShopDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace HardwareShopContracts.StoragesContracts
|
||||
{
|
||||
public class BuildStorage : IBuildStorage
|
||||
{
|
||||
public List<BuildViewModel> GetFullList()
|
||||
{
|
||||
using var context = new HardwareShopDatabase();
|
||||
return context.Builds
|
||||
.Include(x => x.Components)
|
||||
.ThenInclude(x => x.Component)
|
||||
.Include(x => x.Comments)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<BuildViewModel> GetFilteredList(UserSearchModel model)
|
||||
{
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new HardwareShopDatabase();
|
||||
return context.Builds
|
||||
.Include(x => x.Components)
|
||||
.ThenInclude(x => x.Component)
|
||||
.Include(x => x.Comments)
|
||||
.Where(x => x.UserId == model.Id)
|
||||
.ToList()
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public BuildViewModel? GetElement(BuildSearchModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public BuildViewModel? Insert(BuildBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public BuildViewModel? Update(BuildBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public BuildViewModel? Delete(BuildBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
using HardwareShopContracts.BindingModels;
|
||||
using HardwareShopContracts.SearchModels;
|
||||
using HardwareShopContracts.ViewModels;
|
||||
|
||||
namespace HardwareShopContracts.StoragesContracts
|
||||
{
|
||||
public class CommentStorage : ICommentStorage
|
||||
{
|
||||
public List<CommentViewModel> GetFullList()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<CommentViewModel> GetFilteredList(CommentSearchModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public CommentViewModel? GetElement(CommentSearchModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public CommentViewModel? Insert(CommentBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public CommentViewModel? Update(CommentBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public CommentViewModel? Delete(CommentBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
using HardwareShopContracts.BindingModels;
|
||||
using HardwareShopContracts.SearchModels;
|
||||
using HardwareShopContracts.ViewModels;
|
||||
|
||||
namespace HardwareShopContracts.StoragesContracts
|
||||
{
|
||||
public class PurchaseStorage : IPurchaseStorage
|
||||
{
|
||||
public List<PurchaseViewModel> GetFullList()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public List<PurchaseViewModel> GetFilteredList(PurchaseSearchModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public PurchaseViewModel? GetElement(PurchaseSearchModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public PurchaseViewModel? Insert(PurchaseBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public PurchaseViewModel? Update(PurchaseBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public PurchaseViewModel? Delete(PurchaseBindingModel model)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
using HardwareShopDataModels.Enums;
|
||||
using HardwareShopDataModels.Models;
|
||||
using HardwareShopDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
namespace HardwareShopDatabaseImplement.Models.Storekeeper
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user