Api/Brizco.Domain/Entities/Shift/Aggregate.Shift.cs

40 lines
999 B
C#
Raw Normal View History

using System;
namespace Brizco.Domain.Entities.Shift;
2023-09-15 12:37:02 +03:30
public partial class Shift
{
public static Shift Create(string title, string description, TimeSpan startAt, TimeSpan endAt,Guid complexId)
2023-09-15 12:37:02 +03:30
{
return new Shift(title, description, startAt, endAt,complexId);
2023-09-15 12:37:02 +03:30
}
2023-11-13 14:42:49 +03:30
public ShiftDay SetDay(DayOfWeek dayOfWeek)
{
var shiftDay = new ShiftDay(dayOfWeek, this.Id);
this.Days.Add(shiftDay);
return shiftDay;
}
public ShiftPlan AddPlan(DateTime planDate)
2023-09-15 12:37:02 +03:30
{
var plan = new ShiftPlan(planDate , Id);
Plans.Add(plan);
2023-09-15 12:37:02 +03:30
return plan;
}
public ShiftRoutine AddRoutine(Guid routineId)
{
var routine = new ShiftRoutine(routineId, this.Id);
Routines.Add(routine);
return routine;
}
2023-09-15 12:37:02 +03:30
}
public partial class ShiftPlan
{
public ShiftPlanUser AddUser(Guid userId)
{
var planUser = new ShiftPlanUser(Id , userId);
Users.Add(planUser);
2023-09-15 12:37:02 +03:30
return planUser;
}
}