Пример #1
0
 protected Event(Guid id, string name, DateTime start, DateTime end, SeatingPlan seatingPlan)
 {
     Id          = id;
     Name        = name;
     Start       = start;
     End         = end;
     SeatingPlan = seatingPlan;
 }
Пример #2
0
 public static Result <Event> Create(Guid id, string name, DateTime start, DateTime end, SeatingPlan seatingPlan)
 {
     if (id == Guid.Empty)
     {
         return(Result.Fail <Event>("Id must not be empty guid"));
     }
     if (string.IsNullOrWhiteSpace(name))
     {
         return(Result.Fail <Event>("Name must not be empty"));
     }
     if (DateTime.UtcNow > start)
     {
         return(Result.Fail <Event>("Start date must not be in the past"));
     }
     if (end < start)
     {
         return(Result.Fail <Event>("Start date must be before end date"));
     }
     if (seatingPlan == null)
     {
         Result.Fail <Event>("Seating plan must not be null");
     }
     return(Result.Ok <Event>(new Event(id, name, start, end, seatingPlan)));
 }
Пример #3
0
 public static Result <Event> Create(string name, DateTime start, DateTime end, SeatingPlan seatingPlan)
 {
     return(Create(Guid.NewGuid(), name, start, end, seatingPlan));
 }