подправила
This commit is contained in:
parent
13760e8bf9
commit
4af879f620
@ -21,10 +21,7 @@ namespace BeautySalonBusinessLogic.BusinessLogics
|
||||
_logger = logger;
|
||||
_evaluationStorage = evaluationStorage;
|
||||
}
|
||||
public int GetNumberOfPages(int userId, int pageSize = 10)
|
||||
{
|
||||
return _evaluationStorage.GetNumberOfPages(userId, pageSize);
|
||||
}
|
||||
|
||||
public List<EvaluationViewModel>? ReadList(EvaluationSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. Id: {Id}",
|
||||
|
@ -1,4 +1,5 @@
|
||||
using BeautySalonDataModels.Models;
|
||||
using BeautySalonContracts.ViewModels;
|
||||
using BeautySalonDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -13,6 +14,6 @@ namespace BeautySalonContracts.BindingModels
|
||||
public string ServiceName { get; set; } = string.Empty;
|
||||
public double ServicePrice { get; set; }
|
||||
public int StaffMemberId { get; set; }
|
||||
public Dictionary<int, (ICosmeticModel, int)> ServiceCosmetics { get; set; } = new();
|
||||
public List<ServiceCosmeticViewModel> ServiceCosmetics { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,5 @@ namespace BeautySalonContracts.BusinessLogicContracts
|
||||
bool Create(EvaluationBindingModel model);
|
||||
bool Update(EvaluationBindingModel model);
|
||||
bool Delete(EvaluationBindingModel model);
|
||||
int GetNumberOfPages(int userId, int pageSize = 10);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -48,8 +49,8 @@ namespace BeautySalonDatabaseImplement.Models
|
||||
public virtual List<ServiceCosmetic> Cosmetics { get; set; } = new();
|
||||
|
||||
// связь услуги и заказов многие - ко - многим
|
||||
// [ForeignKey("ServiceId")]
|
||||
//public virtual List<OrderService> Orders { get; set; } = new();
|
||||
[ForeignKey("ServiceId")]
|
||||
public virtual List<OrderService> Orders { get; set; } = new();
|
||||
|
||||
public static Service Create(BeautySalonDatabase context, ServiceBindingModel model)
|
||||
{
|
||||
@ -58,13 +59,13 @@ namespace BeautySalonDatabaseImplement.Models
|
||||
Id = model.Id,
|
||||
ServiceName = model.ServiceName,
|
||||
ServicePrice = model.ServicePrice,
|
||||
Cosmetics = model.ServiceCosmetics.Select(x => new CosmeticProcedure()
|
||||
Cosmetics = model.ServiceCosmetics.Select(x => new ServiceCosmetic()
|
||||
{
|
||||
Cosmetic = context.Cosmetics.First(y => y.Id == x.Cosmetic.Id),
|
||||
ProcedureCosmeticCount = x.Count
|
||||
ServiceCosmeticCount = x.Count
|
||||
}).ToList(),
|
||||
StaffMemberId = model.StaffMemberId
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
public void Update(ServiceBindingModel model)
|
||||
|
Loading…
Reference in New Issue
Block a user