예제 #1
0
 public static IEnumerable <DataAttribute> create_memento
     (time.ClockTime clock_time)
 {
     return(new DataAttribute[] {
         DataAttribute.create_value("seconds_from_midnight", clock_time.seconds_from_midnight.ToString())
     });
 }
예제 #2
0
        public static Result <domain.DiaryEntry> create_diary_entry
            (IEnumerable <DataAttribute> attributes)
        {
            var errors = new List <ResultError>();

            time.ClockTime start_time = null;


            attributes
            .collection_for(
                "start_time"
                , () => new StartTimeSerialisationError()
                )
            .bind(time.serialisation.ClockTime.create_clock_time)
            .match(
                success: st => start_time = st
                , error: errs => errors.AddRange(errs)
                );

            return(!errors.Any()
                 ? Result <domain.DiaryEntry> .success(new domain.DiaryEntry(start_time))
                 : Result <domain.DiaryEntry> .error(errors)
                   );
        }
예제 #3
0
 public DiaryEntry
     (time.ClockTime start_time)
 {
     this.start_time = start_time;
 }