productchange
This commit is contained in:
parent
e708ad671d
commit
a87ad2e062
@ -8,6 +8,9 @@ namespace Contracts.BindingModels
|
|||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
|
|
||||||
public Dictionary<int, (IDetailModel, int)> ProductDetails { get; set; } = new();
|
public Dictionary<int, (IDetailModel, int)> ProductDetails { get; set; } = new();
|
||||||
}
|
|
||||||
|
public int? MachineId { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,6 @@ namespace Contracts.SearchModels
|
|||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string? Name { get; set; }
|
public string? Name { get; set; }
|
||||||
public int? UserId { get; set; }
|
public int? UserId { get; set; }
|
||||||
|
public int? MachineId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ namespace Contracts.ViewModels
|
|||||||
[DisplayName("Цена изделия")]
|
[DisplayName("Цена изделия")]
|
||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
|
public int? MachineId { get; set; }
|
||||||
public Dictionary<int, (IDetailModel, int)> DetailProducts { get; set; } = new();
|
public Dictionary<int, (IDetailModel, int)> DetailProducts { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,5 +4,6 @@
|
|||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
double Cost { get; }
|
double Cost { get; }
|
||||||
|
int? MachineId { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ namespace DatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
public virtual Implementer User { get; set; }
|
public virtual Implementer User { get; set; }
|
||||||
|
public int? MachineId { get; set; }
|
||||||
|
public virtual Machine? Machine { get; set; }
|
||||||
private Dictionary<int, (IDetailModel, int)>? _detailProducts = null;
|
private Dictionary<int, (IDetailModel, int)>? _detailProducts = null;
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public Dictionary<int, (IDetailModel, int)> DetailProducts
|
public Dictionary<int, (IDetailModel, int)> DetailProducts
|
||||||
@ -44,6 +46,8 @@ namespace DatabaseImplement.Models
|
|||||||
Name = model.Name,
|
Name = model.Name,
|
||||||
Cost = model.Cost,
|
Cost = model.Cost,
|
||||||
UserId = model.UserId,
|
UserId = model.UserId,
|
||||||
|
MachineId = model.MachineId,
|
||||||
|
Machine = model.MachineId.HasValue ? context.Machines.FirstOrDefault(x => x.Id == model.MachineId) : null,
|
||||||
Details = model.ProductDetails.Select(x => new DetailProduct
|
Details = model.ProductDetails.Select(x => new DetailProduct
|
||||||
{
|
{
|
||||||
Detail = context.Details.First(y => y.Id == x.Key),
|
Detail = context.Details.First(y => y.Id == x.Key),
|
||||||
@ -58,7 +62,8 @@ namespace DatabaseImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
Name = model.Name,
|
Name = model.Name,
|
||||||
Cost = model.Cost,
|
Cost = model.Cost,
|
||||||
UserId = model.UserId
|
UserId = model.UserId,
|
||||||
|
MachineId = model.MachineId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(ProductBindingModel model)
|
public void Update(ProductBindingModel model)
|
||||||
@ -67,6 +72,7 @@ namespace DatabaseImplement.Models
|
|||||||
return;
|
return;
|
||||||
Name = model.Name;
|
Name = model.Name;
|
||||||
Cost = model.Cost;
|
Cost = model.Cost;
|
||||||
|
MachineId = model.MachineId;
|
||||||
}
|
}
|
||||||
public ProductViewModel GetViewModel => new()
|
public ProductViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
@ -74,7 +80,8 @@ namespace DatabaseImplement.Models
|
|||||||
Name = Name,
|
Name = Name,
|
||||||
Cost = Cost,
|
Cost = Cost,
|
||||||
UserId = UserId,
|
UserId = UserId,
|
||||||
DetailProducts = DetailProducts
|
DetailProducts = DetailProducts,
|
||||||
|
MachineId= MachineId
|
||||||
};
|
};
|
||||||
public void UpdateDetails(FactoryGoWorkDatabase context, ProductBindingModel model)
|
public void UpdateDetails(FactoryGoWorkDatabase context, ProductBindingModel model)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user