все еще чиним
This commit is contained in:
parent
b8268cb6b6
commit
fecdbe8d69
@ -15,14 +15,10 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="6.1.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\BeautySalonBusinessLogic\BeautySalonBusinessLogic.csproj" />
|
||||
<ProjectReference Include="..\BeautySalonContracts\BeautySalonContracts.csproj" />
|
||||
<ProjectReference Include="..\BeautySalonDatabaseImplement\BeautySalonDatabaseImplement.csproj" />
|
||||
<ProjectReference Include="..\BeautySalonDataModels\BeautySalonDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -9,17 +9,17 @@ using System.Linq;
|
||||
|
||||
namespace BeautySalonDatabaseImplement.Implements
|
||||
{
|
||||
public class LaborCostsStorage : ILaborCostsStorage
|
||||
public class LaborCostStorage : ILaborCostsStorage
|
||||
{
|
||||
public LaborCostsViewModel? Delete(LaborCostsBindingModel model)
|
||||
{
|
||||
using var context = new BeautySalonDatabase();
|
||||
|
||||
var element = context.LaborCostss.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
var element = context.LaborCosts.FirstOrDefault(rec => rec.Id == model.Id);
|
||||
|
||||
if (element != null)
|
||||
{
|
||||
context.LaborCostss.Remove(element);
|
||||
context.LaborCosts.Remove(element);
|
||||
context.SaveChanges();
|
||||
|
||||
return element.GetViewModel;
|
||||
@ -32,7 +32,7 @@ namespace BeautySalonDatabaseImplement.Implements
|
||||
{
|
||||
using var context = new BeautySalonDatabase();
|
||||
if (model.Id.HasValue)
|
||||
return context.LaborCostss
|
||||
return context.LaborCosts
|
||||
.FirstOrDefault(x => x.Id == model.Id)?
|
||||
.GetViewModel;
|
||||
|
||||
|
@ -27,7 +27,6 @@ namespace BeautySalonDatabaseImplement.Models
|
||||
public virtual LaborCosts LaborCost { get; set; }
|
||||
|
||||
[ForeignKey("CosmeticId")]
|
||||
|
||||
public virtual List<CosmeticProcedure> Procedures { get; set; } = new();
|
||||
|
||||
[ForeignKey("CosmeticId")]
|
||||
|
@ -17,11 +17,6 @@ namespace BeautySalonDatabaseImplement.Models
|
||||
[Required]
|
||||
public int CosmeticId { get; set; }
|
||||
|
||||
|
||||
[Required]
|
||||
public int OrderCosmeticCount { get; set; }
|
||||
|
||||
|
||||
public virtual Order_ Order { get; set; } = new();
|
||||
|
||||
public virtual Cosmetic Cosmetic { get; set; } = new();
|
||||
|
@ -60,7 +60,7 @@ namespace BeautySalonDatabaseImplement.Models
|
||||
get
|
||||
{
|
||||
_orderCosmetics ??= Cosmetics
|
||||
.Select(pc => new OrderCosmeticViewModel(pc.Cosmetic.GetViewModel, pc.OrderCosmeticCount))
|
||||
.Select(pc => new OrderCosmeticViewModel(pc.Cosmetic.GetViewModel))
|
||||
.ToList();
|
||||
return _orderCosmetics;
|
||||
}
|
||||
@ -96,7 +96,6 @@ namespace BeautySalonDatabaseImplement.Models
|
||||
Cosmetics= model.OrderCosmetics.Select(x => new OrderCosmetic()
|
||||
{
|
||||
Cosmetic = context.Cosmetics.First(y => y.Id == x.Cosmetic.Id),
|
||||
OrderCosmeticCount = x.Count
|
||||
}).ToList(),
|
||||
ClientId = model.ClientId,
|
||||
};
|
||||
@ -174,7 +173,6 @@ namespace BeautySalonDatabaseImplement.Models
|
||||
{
|
||||
Order = order,
|
||||
Cosmetic = context.Cosmetics.First(x => x.Id == record.Cosmetic.Id),
|
||||
OrderCosmeticCount = record.Count
|
||||
});
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace BeautySalonDatabaseImplement.Models
|
||||
|
||||
public virtual Client Client { get; set; } = null!;
|
||||
|
||||
private List<ProcedureCosmeticViewModel>? _procedureCosmetics = null;
|
||||
private List<CosmeticProcedureViewModel>? _procedureCosmetics = null;
|
||||
|
||||
[NotMapped]
|
||||
public List<ProcedureCosmeticViewModel> ProcedureCosmetics
|
||||
|
Loading…
Reference in New Issue
Block a user