fix
This commit is contained in:
parent
507fef5fa1
commit
34fdfcfca3
@ -8,6 +8,7 @@ namespace FurnitureContracts.BindingModels
|
||||
public int Cost { get; set; }
|
||||
public int Id { get; set; }
|
||||
public int ManagerId { get; set; }
|
||||
public Dictionary<int, IHeadsetModuleModel> HeadsetModuleId { get; set; }
|
||||
public int HeadsetModuleId { get; set; }
|
||||
public Dictionary<int, ISalesSalonsModel> SalesSalonsId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -5,10 +5,9 @@ namespace FurnitureContracts.BindingModels
|
||||
public class ManagerBindingModel : IManagerModel
|
||||
{
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Login { get; }
|
||||
public string Password { get; }
|
||||
public string Role { get; }
|
||||
|
||||
public string Login { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string Role { get; set; } = string.Empty;
|
||||
public int Id { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,6 @@ namespace FurnitureContracts.BindingModels
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public int Id { get; set; }
|
||||
public int ManagerId { get; set; }
|
||||
public Dictionary<int, IFurnitureModel> FurnitureId { get; set; }
|
||||
public Dictionary<int, ISalesSalonsModel> SalesSalonsId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,6 @@ namespace FurnitureContracts.ViewModel
|
||||
public string Status { get; set; } = string.Empty;
|
||||
public int Id { get; set; }
|
||||
public int ManagerId { get; set; }
|
||||
public Dictionary<int, IFurnitureModel> FurnitureId { get; set; }
|
||||
public Dictionary<int, ISalesSalonsModel> SalesSalonsId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureFactoryDataModels"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FurnitureContracts", "FurnitureContracts\FurnitureContracts.csproj", "{E269E4B8-5EAD-4BB2-A8BA-44FE9D202FB6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FurnitureFactoryDataBaseImplement", "FurnitureFactoryDataBaseImplement\FurnitureFactoryDataBaseImplement.csproj", "{833913DB-1F3F-4700-A200-90759788B1A9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -27,6 +29,10 @@ Global
|
||||
{E269E4B8-5EAD-4BB2-A8BA-44FE9D202FB6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E269E4B8-5EAD-4BB2-A8BA-44FE9D202FB6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E269E4B8-5EAD-4BB2-A8BA-44FE9D202FB6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{833913DB-1F3F-4700-A200-90759788B1A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{833913DB-1F3F-4700-A200-90759788B1A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{833913DB-1F3F-4700-A200-90759788B1A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{833913DB-1F3F-4700-A200-90759788B1A9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureFactoryDataBaseImplement.Models
|
||||
{
|
||||
internal class HeadsetSalesSalons
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int HeadsetId { get; set; }
|
||||
[Required]
|
||||
public int SalesSalonsId { get; set; }
|
||||
public virtual Headset Headset { get; set; } = new();
|
||||
public virtual SalesSalons SalesSalons { get; set; } = new();
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureFactoryDataBaseImplement.Models
|
||||
{
|
||||
internal class Manager
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,124 @@
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Text;
|
||||
//using System.Threading.Tasks;
|
||||
//using FurnitureContracts.BindingModels;
|
||||
//using FurnitureContracts.ViewModel;
|
||||
//using FurnitureFactoryDataModels.Models;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.ComponentModel.DataAnnotations;
|
||||
//using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
//namespace FurnitureFactoryDataBaseImplement.Models
|
||||
//{
|
||||
// internal class Orders : IOrders
|
||||
// {
|
||||
// // мое
|
||||
// //DateTime Date { get; }
|
||||
// //string Status { get; }
|
||||
// //public Dictionary<int, IFurnitureModel> FurnitureId { get; }
|
||||
// //int ManagerId { get; }
|
||||
|
||||
|
||||
|
||||
// string Title { get; }
|
||||
// string Description { get; }
|
||||
// string? TaskName { get; }
|
||||
// DateTime DateCreate { get; }
|
||||
// int TaskId { get; }
|
||||
// int StudentId { get; }
|
||||
// string StudentName { get; }
|
||||
// Dictionary<int, IInterest> DiyInterests { 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, 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; }
|
||||
// [ForeignKey("OrdersId")]
|
||||
// public virtual List<DiyInterest> Interests { get; set; } = new();
|
||||
// public static Diy Create(SchoolDataBase context, DiyBindingModel model)
|
||||
// {
|
||||
// return new Diy()
|
||||
// {
|
||||
// Id = model.Id,
|
||||
// Title = model.Title,
|
||||
// Description = model.Description,
|
||||
// DateCreate = model.DateCreate,
|
||||
// TaskId = model.TaskId,
|
||||
// TaskName = model.TaskName,
|
||||
// StudentId = model.StudentId,
|
||||
// StudentName = model.StudentName,
|
||||
// Interests = model.DiyInterests.Select(x => new DiyInterest
|
||||
// {
|
||||
// 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;
|
||||
// }
|
||||
|
||||
// }
|
||||
//}
|
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FurnitureFactoryDataBaseImplement.Models
|
||||
{
|
||||
internal class OrdersSalesSalons
|
||||
{
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FurnitureFactoryDataModels.Models;
|
||||
using System.ComponentModel;
|
||||
using FurnitureContracts.BindingModels;
|
||||
using FurnitureContracts.ViewModel;
|
||||
|
||||
namespace FurnitureFactoryDataBaseImplement.Models
|
||||
{
|
||||
internal 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]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public string Address { get; set; } = string.Empty;
|
||||
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public int ManagerId { get; set; }
|
||||
public virtual Manager Manager { get; set; }
|
||||
[ForeignKey("HeadsetId")]
|
||||
public virtual List<HeadsetSalesSalons> HeadsetSalesSalons { get; set; } = new();
|
||||
[ForeignKey("OrdersId")]
|
||||
public virtual List<OrdersSalesSalons> OrdersSalesSalons { get; set; } = new();
|
||||
|
||||
public static SalesSalons? Create(SalesSalonsBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new SalesSalons()
|
||||
{
|
||||
Id = model.Id,
|
||||
Name = model.Name,
|
||||
Address = model.Address,
|
||||
ManagerId = model.ManagerId,
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(SalesSalonsBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Name = model.Name;
|
||||
Address = model.Address;
|
||||
}
|
||||
|
||||
public SalesSalonsViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
Name = Name,
|
||||
Address = Address,
|
||||
ManagerId = ManagerId,
|
||||
};
|
||||
}
|
||||
}
|
@ -10,7 +10,8 @@ namespace FurnitureFactoryDataModels.Models
|
||||
{
|
||||
int Cost { get;}
|
||||
string Size { get; }
|
||||
public Dictionary<int, IHeadsetModuleModel> HeadsetModuleId { get; }
|
||||
public Dictionary<int, ISalesSalonsModel> SalesSalonsId { get; }
|
||||
int ManagerId { get; }
|
||||
int HeadsetModuleId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace FurnitureFactoryDataModels.Models
|
||||
{
|
||||
DateTime Date { get; }
|
||||
string Status { get; }
|
||||
public Dictionary<int, IFurnitureModel> FurnitureId { get; }
|
||||
public Dictionary<int, ISalesSalonsModel> SalesSalonsId { get; }
|
||||
int ManagerId { get; }
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ namespace FurnitureFactoryDataModels.Models
|
||||
{
|
||||
string Name { get; }
|
||||
string Address { get; }
|
||||
public Dictionary<int, IOrdersModel> OrdersId { get; }
|
||||
int ManagerId { get; }
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user