Example #1
0
        public static RewardViewModel GetViewModel(Reward reward, List <Reward> checkedRewards)
        {
            var model = new RewardViewModel();

            model.ID          = reward.ID;
            model.Title       = reward.Title;
            model.Description = reward.Description;
            if (checkedRewards != null)
            {
                model.Checked = checkedRewards.Any(r => r.ID == reward.ID);
            }
            return(model);
        }
Example #2
0
        public static UserViewModel GetViewModel(Employee employee, List <Reward> availableRewards)
        {
            var employeemodel = new UserViewModel();

            employeemodel.ID        = employee.ID;
            employeemodel.FirstName = employee.FirstName;
            employeemodel.LastName  = employee.LastName;
            employeemodel.Birth     = employee.Birth;
            employeemodel.Age       = employee.Age;
            var rewards = new List <RewardViewModel>();

            foreach (var reward in availableRewards)
            {
                rewards.Add(RewardViewModel.GetViewModel(reward, employee.Rewards));
            }
            employeemodel.AvailableRewards = rewards.ToList();
            return(employeemodel);
        }