Ejemplo n.º 1
0
        public static AwardViewModel GetViewModel(Award award, List <Award> userRewards)
        {
            var model = new AwardViewModel(award.Title, award.Description)
            {
                Id = award.AwardId
            };

            model.IsAssigned = userRewards.Any(r => r.AwardId == award.AwardId);

            return(model);
        }
Ejemplo n.º 2
0
        public UserViewModel(string fname, string lname, DateTime bdate, List <Award> awards)
        {
            FirstName = fname;
            LastName  = lname;
            Birthdate = bdate;
            Awards    = awards;

            if (awards != null)
            {
                AvailableAwards = new List <AwardViewModel>();
                foreach (var award in Awards)
                {
                    AvailableAwards.Add(AwardViewModel.GetViewModel(award, awards));
                }
            }
        }