Вот базовая модель, от которой я наследую IsDeleted
Код: Выделить всё
public class BaseModel
{
public Guid Id { get; set; }
public bool IsDeleted { get; set; }
}
Код: Выделить всё
public async Task Handle(DeleteCourseRequest request, CancellationToken cancellationToken)
{
var course = await _baseService.GetByPropertyAsyncWithoutMap(c => c.Id == request.Id, c => c.Include(c => c.Centers).Include(c=>c.Sections));
foreach (var center in course.Centers) center.IsDeleted = true;
foreach (var section in course.Sections) section.IsDeleted = true;
await _baseService.Delete(course);
return "Done";
}
Подробнее здесь: https://stackoverflow.com/questions/786 ... ationships