Esempio n. 1
0
        /// <summary>
        /// Take pictograms and choices from DTO and add them to weekday object.
        /// </summary>
        /// <returns>True if all pictograms and choices were found and added, and false otherwise.</returns>
        /// <param name="to">Pictograms and choices will be added to this object.</param>
        /// <param name="from">Pictograms and choices will be read from this object.</param>
        private static async Task <bool> AddPictogramsToWeekday(Weekday to, WeekdayDTO from, IGirafService _giraf)
        {
            if (from.Activities != null)
            {
                foreach (var activityDTO in from.Activities)
                {
                    var picto = await _giraf._context.Pictograms
                                .Where(p => p.Id == activityDTO.Pictogram.Id).FirstOrDefaultAsync();

                    if (picto != null)
                    {
                        to.Activities.Add(new Activity(to, picto, activityDTO.Order, activityDTO.State));
                    }
                }
            }
            return(true);
        }
Esempio n. 2
0
 public Weekday(WeekdayDTO day) : this()
 {
     Day             = day.Day;
     this.Activities = new List <Activity>();
 }