FurnitureFactoryDataBaseImplement Models
This commit is contained in:
parent
0b82011dd2
commit
d040b5293b
@ -9,6 +9,6 @@ namespace FurnitureContracts.BindingModels
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int ManagerId { get; set; }
|
public int ManagerId { get; set; }
|
||||||
public int HeadsetModuleId { get; set; }
|
public int HeadsetModuleId { get; set; }
|
||||||
public Dictionary<int, ISalesSalonsModel> SalesSalonsId { get; set; }
|
public Dictionary<int, ISalesSalonsModel> HeadsetSalesSalons { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ namespace FurnitureContracts.BindingModels
|
|||||||
public string UserName { get; set; } = string.Empty;
|
public string UserName { get; set; } = string.Empty;
|
||||||
public string Login { get; set; } = string.Empty;
|
public string Login { get; set; } = string.Empty;
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
public string Role { get; set; } = string.Empty;
|
public string Role { get; set; } = string.Empty;
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,6 @@ namespace FurnitureContracts.BindingModels
|
|||||||
public string Status { get; set; } = string.Empty;
|
public string Status { get; set; } = string.Empty;
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int ManagerId { get; set; }
|
public int ManagerId { get; set; }
|
||||||
public Dictionary<int, ISalesSalonsModel> SalesSalonsId { get; set; }
|
public Dictionary<int, ISalesSalonsModel> OrdersSalesSalons { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,5 +10,6 @@ namespace FurnitureContracts.SearchModels
|
|||||||
{
|
{
|
||||||
public string? UserName { get; set; }
|
public string? UserName { get; set; }
|
||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
public string? Login { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,9 @@ namespace FurnitureContracts.ViewModel
|
|||||||
[DisplayName("Размер")]
|
[DisplayName("Размер")]
|
||||||
public string Size { get; set; } = string.Empty;
|
public string Size { get; set; } = string.Empty;
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public Dictionary<int, IHeadsetModuleModel> HeadsetModuleId { get; }
|
public int HeadsetModuleId { get; set; }
|
||||||
|
public int ManagerId { get; set; }
|
||||||
|
public Dictionary<int, ISalesSalonsModel> HeadsetSalesSalons { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,10 +7,12 @@ namespace FurnitureContracts.ViewModel
|
|||||||
{
|
{
|
||||||
[DisplayName("Имя пользователя")]
|
[DisplayName("Имя пользователя")]
|
||||||
public string UserName { get; set; } = string.Empty;
|
public string UserName { get; set; } = string.Empty;
|
||||||
|
[DisplayName("Номер")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[DisplayName("Логин")]
|
[DisplayName("Логин")]
|
||||||
public string Login { get; set; } = string.Empty;
|
public string Login { get; set; } = string.Empty;
|
||||||
public string Password { get; }
|
public string Password { get; set; } = string.Empty;
|
||||||
public string Role { get; }
|
public string Role { get; set; } = string.Empty;
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,6 @@ namespace FurnitureContracts.ViewModel
|
|||||||
public string Status { get; set; } = string.Empty;
|
public string Status { get; set; } = string.Empty;
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int ManagerId { get; set; }
|
public int ManagerId { get; set; }
|
||||||
public Dictionary<int, ISalesSalonsModel> SalesSalonsId { get; set; }
|
public Dictionary<int, ISalesSalonsModel> OrdersSalesSalons { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Implements\" />
|
<Folder Include="Implements\" />
|
||||||
</ItemGroup>
|
<Folder Include="Models\" />
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\FurnitureFactoryDataModels\FurnitureFactoryDataModels.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -6,4 +6,13 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Implements\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\FurnitureContracts\FurnitureContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\FurnitureFactoryDataModels\FurnitureFactoryDataModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureFactoryDataBaseImplement.Models
|
||||||
|
{
|
||||||
|
public class Furniture
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,104 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using FurnitureFactoryDataModels.Models;
|
||||||
|
using FurnitureContracts.BindingModels;
|
||||||
|
using FurnitureContracts.ViewModel;
|
||||||
|
using FurnitureContracts.SearchModels;
|
||||||
|
|
||||||
namespace FurnitureFactoryDataBaseImplement.Models
|
namespace FurnitureFactoryDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
internal class Headset
|
public class Headset
|
||||||
{
|
{
|
||||||
|
[Required]
|
||||||
|
public string Size { get; set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public int HeadsetModuleId { get; set; }
|
||||||
|
[Required]
|
||||||
|
public int Cost { get; set; }
|
||||||
|
[Required]
|
||||||
|
public virtual HeadsetModule HeadsetModule { get; set; }
|
||||||
|
[Required]
|
||||||
|
public int ManagerId { get; set; }
|
||||||
|
public virtual Manager Manager { get; set; }
|
||||||
|
private Dictionary<int, ISalesSalonsModel>? _HeadsetSalesSalons = null;
|
||||||
|
[NotMapped]
|
||||||
|
public Dictionary<int, ISalesSalonsModel> HeadsetSalesSalons
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_HeadsetSalesSalons == null)
|
||||||
|
{
|
||||||
|
_HeadsetSalesSalons = SalesSalons
|
||||||
|
.ToDictionary(recPC => recPC.SalesSalonsId, recPC => (recPC.SalesSalons as ISalesSalonsModel));
|
||||||
|
}
|
||||||
|
return _HeadsetSalesSalons;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
[ForeignKey("HeadsetId")]
|
||||||
|
public virtual List<HeadsetSalesSalons> SalesSalons { get; set; } = new();
|
||||||
|
public static Headset Create(FurnitureDataBase context, HeadsetBindingModel model)
|
||||||
|
{
|
||||||
|
return new Headset()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
Size = model.Size,
|
||||||
|
HeadsetModuleId = model.HeadsetModuleId,
|
||||||
|
ManagerId = model.ManagerId,
|
||||||
|
SalesSalons = model.HeadsetSalesSalons.Select(x => new HeadsetSalesSalons
|
||||||
|
{
|
||||||
|
SalesSalons = context.SalesSalons.First(y => y.Id == x.Key),
|
||||||
|
}).ToList()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(HeadsetBindingModel model)
|
||||||
|
{
|
||||||
|
Cost = model.Cost;
|
||||||
|
Size = model.Size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public HeadsetViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
Size = Size,
|
||||||
|
Cost = Cost,
|
||||||
|
HeadsetModuleId = HeadsetModuleId,
|
||||||
|
ManagerId = ManagerId,
|
||||||
|
HeadsetSalesSalons = HeadsetSalesSalons
|
||||||
|
};
|
||||||
|
|
||||||
|
public void UpdateInterests(FurnitureDataBase context, HeadsetBindingModel model)
|
||||||
|
{
|
||||||
|
var headsetSalesSalons = context.HeadsetSalesSalons.Where(rec => rec.HeadsetId == model.Id).ToList();
|
||||||
|
if (headsetSalesSalons != null && HeadsetSalesSalons.Count > 0)
|
||||||
|
{
|
||||||
|
context.HeadsetSalesSalons.RemoveRange(headsetSalesSalons.Where(rec => !model.HeadsetSalesSalons.ContainsKey(rec.SalesSalonsId)));
|
||||||
|
context.SaveChanges();
|
||||||
|
|
||||||
|
foreach (var updateSalesSalons in headsetSalesSalons)
|
||||||
|
{
|
||||||
|
model.HeadsetSalesSalons.Remove(updateSalesSalons.SalesSalonsId);
|
||||||
|
}
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
|
var headset = context.Headsets.First(x => x.Id == Id);
|
||||||
|
foreach (var pc in model.HeadsetSalesSalons)
|
||||||
|
{
|
||||||
|
context.HeadsetSalesSalons.Add(new HeadsetSalesSalons
|
||||||
|
{
|
||||||
|
Headset = headset,
|
||||||
|
SalesSalons = context.SalesSalons.First(x => x.Id == pc.Key),
|
||||||
|
});
|
||||||
|
context.SaveChanges();
|
||||||
|
}
|
||||||
|
_HeadsetSalesSalons = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FurnitureFactoryDataBaseImplement.Models
|
||||||
|
{
|
||||||
|
public class HeadsetModule
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace FurnitureFactoryDataBaseImplement.Models
|
namespace FurnitureFactoryDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
internal class HeadsetSalesSalons
|
public class HeadsetSalesSalons
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
@ -1,12 +1,70 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using FurnitureFactoryDataModels.Models;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using FurnitureContracts.BindingModels;
|
||||||
|
using FurnitureContracts.ViewModel;
|
||||||
|
using FurnitureContracts.SearchModels;
|
||||||
|
|
||||||
namespace FurnitureFactoryDataBaseImplement.Models
|
namespace FurnitureFactoryDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
internal class Manager
|
public class Manager
|
||||||
{
|
{
|
||||||
|
[Required]
|
||||||
|
public string UserName { get; set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public string Role { get; set; }
|
||||||
|
[Required]
|
||||||
|
public string Email { get; set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public string Login { get; set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey("ManagerId")]
|
||||||
|
public virtual List<SalesSalons> SalesSalons { get; set; } = new();
|
||||||
|
[ForeignKey("ManagerId")]
|
||||||
|
public virtual List<Headset> Headsets { get; set; } = new();
|
||||||
|
[ForeignKey("ManagerId")]
|
||||||
|
public virtual List<Orders> Orders { get; set; } = new();
|
||||||
|
public static Manager Create(FurnitureDataBase context, ManagerBindingModel model)
|
||||||
|
{
|
||||||
|
return new Manager()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
UserName = model.UserName,
|
||||||
|
Role = model.Role,
|
||||||
|
Email = model.Email,
|
||||||
|
Login = model.Login,
|
||||||
|
Password = model.Password,
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(ManagerBindingModel model)
|
||||||
|
{
|
||||||
|
UserName = model.UserName;
|
||||||
|
Role = model.Role;
|
||||||
|
Email = model.Email;
|
||||||
|
Login = model.Login;
|
||||||
|
Password = model.Password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ManagerViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
UserName = UserName,
|
||||||
|
Role = Role,
|
||||||
|
Email = Email,
|
||||||
|
Login = Login,
|
||||||
|
Password = Password
|
||||||
|
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,124 +1,101 @@
|
|||||||
//using System;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
//using System.Collections.Generic;
|
using System.ComponentModel.DataAnnotations;
|
||||||
//using System.Linq;
|
using System.Linq;
|
||||||
//using System.Text;
|
using System.Text;
|
||||||
//using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
//using FurnitureContracts.BindingModels;
|
using FurnitureFactoryDataModels.Models;
|
||||||
//using FurnitureContracts.ViewModel;
|
using System.ComponentModel;
|
||||||
//using FurnitureFactoryDataModels.Models;
|
using FurnitureContracts.BindingModels;
|
||||||
//using System;
|
using FurnitureContracts.ViewModel;
|
||||||
//using System.Collections.Generic;
|
|
||||||
//using System.ComponentModel.DataAnnotations;
|
|
||||||
//using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
//namespace FurnitureFactoryDataBaseImplement.Models
|
namespace FurnitureFactoryDataBaseImplement.Models
|
||||||
//{
|
{
|
||||||
// internal class Orders : IOrders
|
public class Orders : IOrdersModel
|
||||||
// {
|
{
|
||||||
// // мое
|
|
||||||
// //DateTime Date { get; }
|
|
||||||
// //string Status { get; }
|
|
||||||
// //public Dictionary<int, IFurnitureModel> FurnitureId { get; }
|
|
||||||
// //int ManagerId { get; }
|
|
||||||
|
|
||||||
|
[Required]
|
||||||
|
public string Status { get; set; } = string.Empty;
|
||||||
|
[Required]
|
||||||
|
public DateTime Date { get; set; }
|
||||||
|
[Required]
|
||||||
|
public int ManagerId { get; set; }
|
||||||
|
public virtual Manager Manager { get; set; }
|
||||||
|
|
||||||
|
private Dictionary<int, ISalesSalonsModel>? _OrdersSalesSalons = null;
|
||||||
|
[NotMapped]
|
||||||
|
public Dictionary<int, ISalesSalonsModel> OrdersSalesSalons
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_OrdersSalesSalons == null)
|
||||||
|
{
|
||||||
|
_OrdersSalesSalons = SalesSalons
|
||||||
|
.ToDictionary(recPC => recPC.SalesSalonsId, recPC => (recPC.SalesSalons as ISalesSalonsModel));
|
||||||
|
}
|
||||||
|
return _OrdersSalesSalons;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// string Title { get; }
|
public int Id { get; set; }
|
||||||
// string Description { get; }
|
[ForeignKey("OrdersId")]
|
||||||
// string? TaskName { get; }
|
public virtual List <OrdersSalesSalons> SalesSalons { get; set; } = new();
|
||||||
// DateTime DateCreate { get; }
|
[ForeignKey("OrdersId")]
|
||||||
// int TaskId { get; }
|
public virtual List<Furniture> Furniture { get; set; } = new();
|
||||||
// int StudentId { get; }
|
public static Orders Create(FurnitureDataBase context, OrdersBindingModel model)
|
||||||
// string StudentName { get; }
|
{
|
||||||
// Dictionary<int, IInterest> DiyInterests { get; }
|
return new Orders()
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
Status = model.Status,
|
||||||
|
Date = model.Date,
|
||||||
|
ManagerId = model.ManagerId,
|
||||||
|
SalesSalons = model.OrdersSalesSalons.Select(x => new OrdersSalesSalons
|
||||||
|
{
|
||||||
|
SalesSalons = context.SalesSalons.First(y => y.Id == x.Key),
|
||||||
|
}).ToList()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(OrdersBindingModel model)
|
||||||
|
{
|
||||||
|
Status = model.Status;
|
||||||
|
Date = model.Date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrdersViewModel GetViewModel => new()
|
||||||
|
{
|
||||||
|
Id = Id,
|
||||||
|
Status = Status,
|
||||||
|
Date = Date,
|
||||||
|
ManagerId = ManagerId,
|
||||||
|
OrdersSalesSalons = OrdersSalesSalons
|
||||||
|
};
|
||||||
|
|
||||||
// [Required]
|
public void UpdateInterests(FurnitureDataBase context, OrdersBindingModel model)
|
||||||
// public string Status { get; set; } = string.Empty;
|
{
|
||||||
// [Required]
|
var ordersSalesSalons = context.OrdersSalesSalons.Where(rec => rec.OrdersId == model.Id).ToList();
|
||||||
// public DateTime Date { get; set; }
|
if (ordersSalesSalons != null && OrdersSalesSalons.Count > 0)
|
||||||
// [Required]
|
{
|
||||||
// public int ManagerId { get; set; }
|
context.OrdersSalesSalons.RemoveRange(ordersSalesSalons.Where(rec => !model.OrdersSalesSalons.ContainsKey(rec.SalesSalonsId)));
|
||||||
// public virtual Manager Manager { get; set; }
|
context.SaveChanges();
|
||||||
// private Dictionary<int, IFurnitureModel>? _FurnitureId = null;
|
|
||||||
// [NotMapped]
|
|
||||||
// public Dictionary<int, IFurnitureModel> FurnitureId
|
|
||||||
// {
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// if (_FurnitureId == null)
|
|
||||||
// {
|
|
||||||
// _FurnitureId = Furniture
|
|
||||||
// .ToDictionary(recPC => recPC.FurnitureId, recPC => (recPC.Furniture as IFurniture));
|
|
||||||
// }
|
|
||||||
// return _FurnitureId;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public int Id { get; set; }
|
foreach (var updateSalesSalons in ordersSalesSalons)
|
||||||
// [ForeignKey("OrdersId")]
|
{
|
||||||
// public virtual List<DiyInterest> Interests { get; set; } = new();
|
model.OrdersSalesSalons.Remove(updateSalesSalons.SalesSalonsId);
|
||||||
// public static Diy Create(SchoolDataBase context, DiyBindingModel model)
|
}
|
||||||
// {
|
context.SaveChanges();
|
||||||
// return new Diy()
|
}
|
||||||
// {
|
var orders = context.Orders.First(x => x.Id == Id);
|
||||||
// Id = model.Id,
|
foreach (var pc in model.OrdersSalesSalons)
|
||||||
// Title = model.Title,
|
{
|
||||||
// Description = model.Description,
|
context.OrdersSalesSalons.Add(new OrdersSalesSalons
|
||||||
// DateCreate = model.DateCreate,
|
{
|
||||||
// TaskId = model.TaskId,
|
Orders = orders,
|
||||||
// TaskName = model.TaskName,
|
SalesSalons = context.SalesSalons.First(x => x.Id == pc.Key),
|
||||||
// StudentId = model.StudentId,
|
});
|
||||||
// StudentName = model.StudentName,
|
context.SaveChanges();
|
||||||
// Interests = model.DiyInterests.Select(x => new DiyInterest
|
}
|
||||||
// {
|
_OrdersSalesSalons = null;
|
||||||
// Interest = context.Interests.First(y => y.Id == x.Key),
|
}
|
||||||
// }).ToList()
|
}
|
||||||
// };
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// public void Update(OrdersBindingModel model)
|
|
||||||
// {
|
|
||||||
// Status = model.Status;
|
|
||||||
// Date = model.Date;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public OrdersViewModel GetViewModel => new()
|
|
||||||
// {
|
|
||||||
// Id = Id,
|
|
||||||
// Status=Status,
|
|
||||||
// Date = Date,
|
|
||||||
// ManagerId = ManagerId,
|
|
||||||
// FurnitureId = FurnitureId
|
|
||||||
// };
|
|
||||||
|
|
||||||
// public void UpdateInterests(FurnitureDataBase context, OrdersBindingModel model)
|
|
||||||
// {
|
|
||||||
// var diyInterests = context.DiyInterests.Where(rec => rec.DiyId == model.Id).ToList();
|
|
||||||
// if (diyInterests != null && diyInterests.Count > 0)
|
|
||||||
// {
|
|
||||||
// context.DiyInterests.RemoveRange(diyInterests.Where(rec => !model.DiyInterests.ContainsKey(rec.InterestId)));
|
|
||||||
// context.SaveChanges();
|
|
||||||
|
|
||||||
// foreach (var updateInterest in diyInterests)
|
|
||||||
// {
|
|
||||||
// model.DiyInterests.Remove(updateInterest.InterestId);
|
|
||||||
// }
|
|
||||||
// context.SaveChanges();
|
|
||||||
// }
|
|
||||||
// var diy = context.Diys.First(x => x.Id == Id);
|
|
||||||
// foreach (var pc in model.DiyInterests)
|
|
||||||
// {
|
|
||||||
// context.DiyInterests.Add(new DiyInterest
|
|
||||||
// {
|
|
||||||
// Diy = diy,
|
|
||||||
// Interest = context.Interests.First(x => x.Id == pc.Key),
|
|
||||||
// });
|
|
||||||
// context.SaveChanges();
|
|
||||||
// }
|
|
||||||
// _DiyInterests = null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
@ -1,12 +1,20 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace FurnitureFactoryDataBaseImplement.Models
|
namespace FurnitureFactoryDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
internal class OrdersSalesSalons
|
public class OrdersSalesSalons
|
||||||
{
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
[Required]
|
||||||
|
public int OrdersId { get; set; }
|
||||||
|
[Required]
|
||||||
|
public int SalesSalonsId { get; set; }
|
||||||
|
public virtual Orders Orders { get; set; } = new();
|
||||||
|
public virtual SalesSalons SalesSalons { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,25 +12,8 @@ using FurnitureContracts.ViewModel;
|
|||||||
|
|
||||||
namespace FurnitureFactoryDataBaseImplement.Models
|
namespace FurnitureFactoryDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
internal class SalesSalons
|
public class SalesSalons
|
||||||
{
|
{
|
||||||
//[DisplayName("Название")]
|
|
||||||
//public string Name { get; set; } = string.Empty;
|
|
||||||
//[DisplayName("Адресс")]
|
|
||||||
//public string Address { get; set; } = string.Empty;
|
|
||||||
//public int Id { get; set; }
|
|
||||||
//public int ManagerId { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//public int StudentId { get; set; }
|
|
||||||
//[DisplayName("Название")]
|
|
||||||
//public string Title { get; set; } = string.Empty;
|
|
||||||
//[DisplayName("Описание")]
|
|
||||||
//public string Description { get; set; } = string.Empty;
|
|
||||||
//[DisplayName("Номер")]
|
|
||||||
//public int Id { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
@ -41,9 +24,9 @@ namespace FurnitureFactoryDataBaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int ManagerId { get; set; }
|
public int ManagerId { get; set; }
|
||||||
public virtual Manager Manager { get; set; }
|
public virtual Manager Manager { get; set; }
|
||||||
[ForeignKey("HeadsetId")]
|
[ForeignKey("SalesSalonsId")]
|
||||||
public virtual List<HeadsetSalesSalons> HeadsetSalesSalons { get; set; } = new();
|
public virtual List<HeadsetSalesSalons> HeadsetSalesSalons { get; set; } = new();
|
||||||
[ForeignKey("OrdersId")]
|
[ForeignKey("SalesSalonsId")]
|
||||||
public virtual List<OrdersSalesSalons> OrdersSalesSalons { get; set; } = new();
|
public virtual List<OrdersSalesSalons> OrdersSalesSalons { get; set; } = new();
|
||||||
|
|
||||||
public static SalesSalons? Create(SalesSalonsBindingModel model)
|
public static SalesSalons? Create(SalesSalonsBindingModel model)
|
||||||
|
@ -10,7 +10,7 @@ namespace FurnitureFactoryDataModels.Models
|
|||||||
{
|
{
|
||||||
int Cost { get;}
|
int Cost { get;}
|
||||||
string Size { get; }
|
string Size { get; }
|
||||||
public Dictionary<int, ISalesSalonsModel> SalesSalonsId { get; }
|
public Dictionary<int, ISalesSalonsModel> HeadsetSalesSalons { get; }
|
||||||
int ManagerId { get; }
|
int ManagerId { get; }
|
||||||
int HeadsetModuleId { get; }
|
int HeadsetModuleId { get; }
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -10,6 +11,7 @@ namespace FurnitureFactoryDataModels.Models
|
|||||||
{
|
{
|
||||||
string Login { get; }
|
string Login { get; }
|
||||||
string Password { get; }
|
string Password { get; }
|
||||||
|
string Email { get; }
|
||||||
string Role { get; }
|
string Role { get; }
|
||||||
string UserName { get; }
|
string UserName { get; }
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ namespace FurnitureFactoryDataModels.Models
|
|||||||
{
|
{
|
||||||
DateTime Date { get; }
|
DateTime Date { get; }
|
||||||
string Status { get; }
|
string Status { get; }
|
||||||
public Dictionary<int, ISalesSalonsModel> SalesSalonsId { get; }
|
public Dictionary<int, ISalesSalonsModel> OrdersSalesSalons { get; }
|
||||||
int ManagerId { get; }
|
int ManagerId { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user