Ejemplo n.º 1
0
        public void AddChoresList(ChoreDoer doer, Group group)
        {
            var choreModels = new List <ChoreModel>();

            var chores = group.Chores.Where(c => c.AssignedTo == doer);

            if (chores.Count() > 0)
            {
                foreach (var chore in chores)
                {
                    choreModels.Add(ChoreModel.ConvertFromChore(chore));
                }
            }

            Chores = choreModels;
        }
Ejemplo n.º 2
0
        public static ChoreModel ConvertFromChore(Chore chore)
        {
            var model = new ChoreModel();

            model.ChoreId     = chore.ChoreId;
            model.Name        = chore.Name;
            model.Difficulty  = chore.Difficulty;
            model.Description = chore.Description;


            if (chore.LastCompleted != null)
            {
                model.LastCompleted     = chore.LastCompleted;
                model.LastCompletedById = chore.LastCompletedBy.ChoreDoerId;
                model.LastCompletedBy   = chore.LastCompletedBy.Name;
            }
            ChoreDoer doer = chore.AssignedTo;

            model.AssignedToId = doer.ChoreDoerId;
            model.AssignedTo   = doer.Name;

            return(model);
        }