все еще чиним

This commit is contained in:
Milana Ievlewa 2024-04-30 13:56:36 +03:00
parent b8268cb6b6
commit fecdbe8d69
6 changed files with 6 additions and 18 deletions

View File

@ -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>

View File

@ -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;

View File

@ -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")]

View File

@ -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();

View File

@ -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();
}

View File

@ -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