Example #1
0
        public ActivityViewModel(Activity activity)
        {
            Id = activity.Id;
            if (activity.Campaign != null)
            {
                CampaignId = activity.Campaign.Id;
                CampaignName = activity.Campaign.Name;
            }

            Title = activity.Name;
            Description = activity.Description;

            StartDateTime = new DateTimeOffset(activity.StartDateTimeUtc, TimeSpan.Zero);
            EndDateTime = new DateTimeOffset(activity.EndDateTimeUtc, TimeSpan.Zero);

            if (activity.Location != null)
            {
                Location = new LocationViewModel(activity.Location);
            }

            ImageUrl = activity.ImageUrl;

            //TODO Location
            Tasks = activity.Tasks != null
                 ? new List<TaskViewModel>(activity.Tasks.Select(data => new TaskViewModel(data)).OrderBy(task => task.StartDateTime))
                 : new List<TaskViewModel>();

            RequiredSkills = activity.RequiredSkills?.Select(acsk => acsk.Skill).ToList();
        }
        public void ReturnStateWhenCityNotPresent()
        {
            // arrange
            var model = new LocationViewModel { State = "Utopia" };

            // assert
            Assert.Equal("Utopia", model.Summary);

        }
        public void ReturnCityWhenStateNotPresent()
        {
            // arrange
            var model = new LocationViewModel { City = "HappyTown" };

            // assert
            Assert.Equal("HappyTown", model.Summary);

        }
Example #4
0
 public static LocationViewModel ToViewModel(this Location location)
 {
     LocationViewModel value = new LocationViewModel()
     {
         Address1 = location.Address1,
         Address2 = location.Address2,
         City = location.City,
         PostalCode = location.PostalCode,
         State = location.State
     };
     return value;
 }
        public void ReturnCityAndStateWhenBothArePresent()
        {
            // arrange
            var model = new LocationViewModel{
                City = "HappyTown",
                State = "Utopia"
            };

            // assert
            Assert.Equal("HappyTown, Utopia", model.Summary);

        }
Example #6
0
        public EventViewModel(Event campaignEvent)
        {
            Id = campaignEvent.Id;
            if (campaignEvent.Campaign != null)
            {
                CampaignId = campaignEvent.Campaign.Id;
                CampaignName = campaignEvent.Campaign.Name;
                TimeZoneId = campaignEvent.Campaign.TimeZoneId;
                if (campaignEvent.Campaign.ManagingOrganization != null)
                {
                    OrganizationId = campaignEvent.Campaign.ManagingOrganization.Id;
                    OrganizationName = campaignEvent.Campaign.ManagingOrganization.Name;
                    HasPrivacyPolicy = !string.IsNullOrEmpty(campaignEvent.Campaign.ManagingOrganization.PrivacyPolicy);
                }
            }

            Title = campaignEvent.Name;
            Description = campaignEvent.Description;
            EventType = campaignEvent.EventType;
            StartDateTime = campaignEvent.StartDateTime;
            EndDateTime = campaignEvent.EndDateTime;

            if (campaignEvent.Location != null)
            {
                Location = new LocationViewModel(campaignEvent.Location);
            }

            IsClosed = EndDateTime.UtcDateTime < DateTimeOffset.UtcNow;

            ImageUrl = campaignEvent.ImageUrl;

            //TODO Location
            Tasks = campaignEvent.Tasks != null
                 ? new List<TaskViewModel>(campaignEvent.Tasks.Select(data => new TaskViewModel(data)).OrderBy(task => task.StartDateTime))
                 : new List<TaskViewModel>();

            SignupModel = new EventSignupViewModel();

            RequiredSkills = campaignEvent.RequiredSkills?.Select(acsk => acsk.Skill).ToList();
            IsLimitVolunteers = campaignEvent.IsLimitVolunteers;
            IsAllowWaitList = campaignEvent.IsAllowWaitList;
            
        }
Example #7
0
        public EventViewModel(Event campaignEvent)
        {
            Id = campaignEvent.Id;
            if (campaignEvent.Campaign != null)
            {
                CampaignId   = campaignEvent.Campaign.Id;
                CampaignName = campaignEvent.Campaign.Name;
                TimeZoneId   = campaignEvent.Campaign.TimeZoneId;
                if (campaignEvent.Campaign.ManagingOrganization != null)
                {
                    OrganizationId   = campaignEvent.Campaign.ManagingOrganization.Id;
                    OrganizationName = campaignEvent.Campaign.ManagingOrganization.Name;
                    HasPrivacyPolicy = !string.IsNullOrEmpty(campaignEvent.Campaign.ManagingOrganization.PrivacyPolicy);
                }
            }

            Title         = campaignEvent.Name;
            Description   = campaignEvent.Description;
            EventType     = campaignEvent.EventType;
            StartDateTime = campaignEvent.StartDateTime;
            EndDateTime   = campaignEvent.EndDateTime;

            if (campaignEvent.Location != null)
            {
                Location = new LocationViewModel(campaignEvent.Location);
            }

            IsClosed = EndDateTime.UtcDateTime < DateTimeOffset.UtcNow;

            ImageUrl = campaignEvent.ImageUrl;

            //TODO Location
            Tasks = campaignEvent.Tasks != null
                 ? new List <TaskViewModel>(campaignEvent.Tasks.Select(data => new TaskViewModel(data)).OrderBy(task => task.StartDateTime))
                 : new List <TaskViewModel>();

            SignupModel = new EventSignupViewModel();

            RequiredSkills    = campaignEvent.RequiredSkills?.Select(acsk => acsk.Skill).ToList();
            IsLimitVolunteers = campaignEvent.IsLimitVolunteers;
            IsAllowWaitList   = campaignEvent.IsAllowWaitList;
        }
Example #8
0
        public ActivityViewModel(Activity activity)
        {
            Id = activity.Id;
            if (activity.Campaign != null)
            {
                CampaignId = activity.Campaign.Id;
                CampaignName = activity.Campaign.Name;
            }

            OrganizationId = activity.Campaign.ManagingOrganization.Id;
            OrganizationName = activity.Campaign.ManagingOrganization.Name;

            Title = activity.Name;
            Description = activity.Description;
            ActivityType = activity.ActivityType;

            TimeZoneId = activity.Campaign.TimeZoneId;
            StartDateTime = activity.StartDateTime;
            EndDateTime = activity.EndDateTime;

            if (activity.Location != null)
            {
                Location = new LocationViewModel(activity.Location);
            }

            IsClosed = EndDateTime.UtcDateTime < DateTimeOffset.UtcNow;

            ImageUrl = activity.ImageUrl;

            //TODO Location
            Tasks = activity.Tasks != null
                 ? new List<TaskViewModel>(activity.Tasks.Select(data => new TaskViewModel(data)).OrderBy(task => task.StartDateTime))
                 : new List<TaskViewModel>();

            RequiredSkills = activity.RequiredSkills?.Select(acsk => acsk.Skill).ToList();

            HasPrivacyPolicy = !string.IsNullOrEmpty(activity.Campaign.ManagingOrganization.PrivacyPolicy);
        }