• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Models.Campaign类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AllReady.Models.Campaign的典型用法代码示例。如果您正苦于以下问题:C# Campaign类的具体用法?C# Campaign怎么用?C# Campaign使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Campaign类属于AllReady.Models命名空间,在下文中一共展示了Campaign类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ActivityDoesNotExist

        public void ActivityDoesNotExist()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            Organization htb = new Organization()
            {
                Id = 123,
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };
            Campaign firePrev = new Campaign()
            {
                Id = 1,
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb,
                TimeZoneId = "Central Standard Time"
            };
            htb.Campaigns.Add(firePrev);
            context.Organizations.Add(htb);
            context.SaveChanges();

            var vm = new ActivityDetailModel
            {
                CampaignId = 1,
                TimeZoneId = "Central Standard Time"
            };
            var query = new EditActivityCommand { Activity = vm };
            var handler = new EditActivityCommandHandler(context);
            var result = handler.Handle(query);
            Assert.True(result > 0);

            var data = context.Activities.Count(_ => _.Id == result);
            Assert.True(data == 1);
        }
开发者ID:weiplanet,项目名称:allReady,代码行数:35,代码来源:EditActivity.cs


示例2: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            Tenant htb = new Tenant()
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };
            Campaign firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingTenant = htb
            };
            Activity queenAnne = new Activity()
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTimeUtc = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTimeUtc = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<ActivitySkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            context.Users.Add(user1);

            htb.Campaigns.Add(firePrev);
            context.Tenants.Add(htb);
            context.Activities.Add(queenAnne);

            var activitySignups = new List<ActivitySignup>();
            activitySignups.Add(new ActivitySignup { Activity = queenAnne, User = user1, SignupDateTime = DateTime.UtcNow });

            context.ActivitySignup.AddRange(activitySignups);

            var newTask = new AllReadyTask()
            {
                Activity = queenAnne,
                Description = "Description of a very important task",
                Name = "Task # 1",
                EndDateTimeUtc = DateTime.Now.AddDays(5),
                StartDateTimeUtc = DateTime.Now.AddDays(3),
                Tenant = htb
            };
            newTask.AssignedVolunteers.Add(new TaskSignup()
            {
                Task = newTask,
                User = user1
            });
            context.Tasks.Add(newTask);

            context.SaveChanges();
        }
开发者ID:fr33k3r,项目名称:allReady,代码行数:60,代码来源:SignupStatusChange.cs


示例3: ExistingActivity

        public void ExistingActivity()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            Tenant htb = new Tenant()
            {
                Id = 123,
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };
            Campaign firePrev = new Campaign()
            {
                Id = 1,
                Name = "Neighborhood Fire Prevention Days",
                ManagingTenant = htb
            };
            htb.Campaigns.Add(firePrev);
            Activity queenAnne = new Activity()
            {
                Id = 100,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTimeUtc = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTimeUtc = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<ActivitySkill>()
            };
            context.Tenants.Add(htb);
            context.Activities.Add(queenAnne);
            context.SaveChanges();

            const string NEW_NAME = "Some new name value";

            var vm = new ActivityDetailModel
            {
                CampaignId = queenAnne.CampaignId,
                CampaignName = queenAnne.Campaign.Name,
                Description = queenAnne.Description,
                EndDateTime = queenAnne.EndDateTimeUtc,
                Id = queenAnne.Id,
                ImageUrl = queenAnne.ImageUrl,
                Location = null,
                Name = NEW_NAME,
                RequiredSkills = queenAnne.RequiredSkills,
                StartDateTime = queenAnne.StartDateTimeUtc,
                Tasks = null,
                TenantId = queenAnne.Campaign.ManagingTenantId,
                TenantName = queenAnne.Campaign.ManagingTenant.Name,
                Volunteers = null
            };
            var query = new EditActivityCommand { Activity = vm };
            var handler = new EditActivityCommandHandler(context);
            var result = handler.Handle(query);
            Assert.Equal(100, result); // should get back the activity id

            var data = context.Activities.Single(_ => _.Id == result);
            Assert.Equal(NEW_NAME, data.Name);
        }
开发者ID:fr33k3r,项目名称:allReady,代码行数:60,代码来源:EditActivity.cs


示例4: LoadTestData

 protected override void LoadTestData()
 {
     var context = ServiceProvider.GetService<AllReadyContext>();
     Tenant htb = new Tenant()
     {
         Name = "Humanitarian Toolbox",
         LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
         WebUrl = "http://www.htbox.org",
         Campaigns = new List<Campaign>()
     };
     Campaign firePrev = new Campaign()
     {
         Name = "Neighborhood Fire Prevention Days",
         ManagingTenant = htb
     };
     htb.Campaigns.Add(firePrev);
     Activity queenAnne = new Activity()
     {
         Id = 1,
         Name = "Queen Anne Fire Prevention Day",
         Campaign = firePrev,
         CampaignId = firePrev.Id,
         StartDateTimeUtc = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
         EndDateTimeUtc = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
         Location = new Location { Id = 1 },
         Tenant = htb,
         RequiredSkills = new List<ActivitySkill>()
     };
     context.Tenants.Add(htb);
     context.Activities.Add(queenAnne);
     context.SaveChanges();
 }
开发者ID:BredStik,项目名称:allReady,代码行数:32,代码来源:GetActivityDetail.cs


示例5: GetCampaignsByPostalCodeReturnsCorrectResults

        public void GetCampaignsByPostalCodeReturnsCorrectResults()
        {
            var activity1 = new Activity { Id = 1, CampaignId = 1 };
            activity1.Campaign = new Campaign { Id = 1, Activities = new List<Activity> { activity1 }, ManagingOrganization = new Organization() };

            var activity2 = new Activity { Id = 2 };
            var activity3 = new Activity { Id = 3 };
            var campaign2 = new Campaign { Id = 2, Activities = new List<Activity> { activity2, activity3 }, ManagingOrganization = new Organization() };

            activity2.CampaignId = campaign2.Id;
            activity2.Campaign = campaign2;

            activity3.CampaignId = campaign2.Id;
            activity3.Campaign = campaign2;

            var allActivities = new List<Activity> { activity1, activity2, activity3 };

            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.Send(It.IsAny<AcitivitiesByPostalCodeQuery>())).Returns(allActivities);

            var sut = new CampaignApiController(mediator.Object);
            var results = sut.GetCampaignsByPostalCode(It.IsAny<string>(), It.IsAny<int>());

            Assert.Equal(results.Count(), allActivities.Count);
        }
开发者ID:mmoore99,项目名称:allReady,代码行数:25,代码来源:CampaignApiControllerTests.cs


示例6: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            var htb = new Organization
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };

            var queenAnne = new Event
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<EventSkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            context.Users.Add(user1);
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true };
            context.Users.Add(user2);

            htb.Campaigns.Add(firePrev);            
            context.Organizations.Add(htb);
            
            var task = new AllReadyTask
            {
                Event = queenAnne,
                Description = "Description of a very important task",
                Name = "Task # ",
                EndDateTime = DateTime.Now.AddDays(1),
                StartDateTime = DateTime.Now.AddDays(-3)
            };
            queenAnne.Tasks.Add(task);
            context.Events.Add(queenAnne);

            var taskSignups = new List<TaskSignup>
            {
                new TaskSignup { Task = task, User = user1 },
                new TaskSignup { Task = task, User = user2 }
            };
            context.TaskSignups.AddRange(taskSignups);

            context.SaveChanges();
        }
开发者ID:codethug,项目名称:allReady,代码行数:60,代码来源:MessageTaskVolunteersCommandHandlerAsyncTests.cs


示例7: ExistingCampaign

        public void ExistingCampaign()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            Organization htb = new Organization()
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };
            Campaign firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb,
                TimeZoneId = "Eastern Standard Time"
            };
            htb.Campaigns.Add(firePrev);
            context.Organizations.Add(htb);
            context.SaveChanges();

            const string NEW_NAME = "Some new name value";

            var startDate = new DateTime(2014, 12, 10);
            var endDate = new DateTime(2015, 7, 3);
            var vm = new CampaignSummaryModel
            {
                Description = firePrev.Description,
                EndDate = endDate,
                FullDescription = firePrev.FullDescription,
                StartDate = startDate,
                Id = firePrev.Id,
                ImageUrl = firePrev.ImageUrl,
                Name = NEW_NAME,
                OrganizationId = firePrev.ManagingOrganizationId,
                OrganizationName = firePrev.ManagingOrganization.Name,
                TimeZoneId = "Eastern Standard Time"
            };
            var query = new EditCampaignCommand { Campaign = vm };
            var handler = new EditCampaignCommandHandler(context);
            var result = handler.Handle(query);
            Assert.Equal(1, result); // should get back the Campaign id

            var data = context.Campaigns.Single(_ => _.Id == 1);
            Assert.Equal(NEW_NAME, data.Name);

            Assert.Equal(2014, data.StartDateTime.Year);
            Assert.Equal(12, data.StartDateTime.Month);
            Assert.Equal(10, data.StartDateTime.Day);
            Assert.Equal(00, data.StartDateTime.Hour);
            Assert.Equal(00, data.StartDateTime.Minute);
            Assert.Equal(-5, data.StartDateTime.Offset.TotalHours);

            Assert.Equal(2015, data.EndDateTime.Year);
            Assert.Equal(7, data.EndDateTime.Month);
            Assert.Equal(3, data.EndDateTime.Day);
            Assert.Equal(23, data.EndDateTime.Hour);
            Assert.Equal(59, data.EndDateTime.Minute);
            Assert.Equal(-4, data.EndDateTime.Offset.TotalHours);
            
        }
开发者ID:weiplanet,项目名称:allReady,代码行数:60,代码来源:EditCampaign.cs


示例8: LoadTestData

 protected override void LoadTestData()
 {
     var context = ServiceProvider.GetService<AllReadyContext>();
     Organization htb = new Organization()
     {
         Id = 1,
         Name = "Humanitarian Toolbox",
         LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
         WebUrl = "http://www.htbox.org",
         Campaigns = new List<Campaign>(),                
     };
     Organization other = new Organization()
     {
         Id = 2,
         Name = "Other Org",
         Campaigns = new List<Campaign>(),
     };
     Campaign firePrev = new Campaign()
     {
         Id = 1,
         Name = "Neighborhood Fire Prevention Days",
         ManagingOrganization = htb
     };
     Campaign otherCampaign = new Campaign()
     {
         Id = 2,
         Name = "Some other campaign",
         ManagingOrganization = other
     };
     htb.Campaigns.Add(firePrev);
     context.Organizations.Add(htb);
     other.Campaigns.Add(otherCampaign);
     context.Organizations.Add(other);
     context.SaveChanges();
 }
开发者ID:weiplanet,项目名称:allReady,代码行数:35,代码来源:GetCampaignList.cs


示例9: GetCampaignsByPostalCodeReturnsCorrectResults

        public void GetCampaignsByPostalCodeReturnsCorrectResults()
        {
            var event1 = new Event { Id = 1, CampaignId = 1 };
            event1.Campaign = new Campaign { Id = 1, Events = new List<Event> { event1 }, ManagingOrganization = new Organization() };

            var event2 = new Event { Id = 2 };
            var event3 = new Event { Id = 3 };
            var campaign2 = new Campaign { Id = 2, Events = new List<Event> { event2, event3 }, ManagingOrganization = new Organization() };

            event2.CampaignId = campaign2.Id;
            event2.Campaign = campaign2;

            event3.CampaignId = campaign2.Id;
            event3.Campaign = campaign2;

            var allEvents = new List<Event> { event1, event2, event3 };

            var mediator = new Mock<IMediator>();
            mediator.Setup(x => x.Send(It.IsAny<EventsByPostalCodeQuery>())).Returns(allEvents);

            var sut = new CampaignApiController(mediator.Object);
            var results = sut.GetCampaignsByPostalCode(It.IsAny<string>(), It.IsAny<int>());

            Assert.Equal(results.Count(), allEvents.Count);
        }
开发者ID:shawnwildermuth,项目名称:allReady,代码行数:25,代码来源:CampaignApiControllerTests.cs


示例10: LoadTestData

        protected override void LoadTestData()
        {
            var htb = new Organization()
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };

            var queenAnne = new Event()
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<EventSkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            Context.Users.Add(user1);
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true };
            Context.Users.Add(user2);

            var task = new AllReadyTask
            {
                Id = 1,
                Name = "Task 1",
                Event = queenAnne,
            };

            var taskSignup = new TaskSignup
            {
                Id = 1,
                User = user1,
                Task = task
            };

            htb.Campaigns.Add(firePrev);            
            Context.Organizations.Add(htb);
            Context.Events.Add(queenAnne);
            Context.Tasks.Add(task);
            Context.TaskSignups.Add(taskSignup);

            Context.SaveChanges();
        }
开发者ID:ChrisDobby,项目名称:allReady,代码行数:58,代码来源:MessageEventVolunteersCommandHandlerTests.cs


示例11: SetOrganizationIdAndOrganizationName_WhenConstructingWithNonNullCampaignAndNonNullManagingOrganization

        public void SetOrganizationIdAndOrganizationName_WhenConstructingWithNonNullCampaignAndNonNullManagingOrganization()
        {
            var campaign = new Campaign { ManagingOrganization = new Organization { Id = 1, Name = "OrgName" } };
            var @event = new Event { Campaign = campaign };
            var sut = new EventViewModel(@event);

            Assert.Equal(sut.OrganizationId, campaign.ManagingOrganization.Id);
            Assert.Equal(sut.OrganizationName, campaign.ManagingOrganization.Name);
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:9,代码来源:EventViewModelShould.cs


示例12: CampaignByApplicationUserIdQueryHandlerShould

        public CampaignByApplicationUserIdQueryHandlerShould()
        {
            message = new CampaignByApplicationUserIdQuery() { ApplicationUserId = Guid.NewGuid().ToString() };
            campaign = new Campaign {  Organizer  =  new ApplicationUser() { Id = message.ApplicationUserId } };

            Context.Add(campaign);
            Context.SaveChanges();

            sut = new CampaignByApplicationUserIdQueryHandler(Context);
        }
开发者ID:HTBox,项目名称:allReady,代码行数:10,代码来源:CampaignByApplicationUserIdQueryHandlerShould.cs


示例13: CampaignByCampaignIdQueryHandlerShould

        public CampaignByCampaignIdQueryHandlerShould()
        {
            message = new CampaignByCampaignIdQuery { CampaignId = 1 };
            campaign = new Campaign { Id = message.CampaignId, Published = true };

            Context.Add(campaign);
            Context.SaveChanges();

            sut = new CampaignByCampaignIdQueryHandler(Context);
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:10,代码来源:CampaignByCampaignIdQueryHandlerShould.cs


示例14: SetCampaignIdCampaignNameAndTimeZoneId_WhenConstructingWithNonNullCampaign

        public void SetCampaignIdCampaignNameAndTimeZoneId_WhenConstructingWithNonNullCampaign()
        {
            var campaign = new Campaign { Id = 1, Name = "Campaignname", TimeZoneId = "CampaignTimeZoneId" };
            var @event = new Event { Campaign = campaign, TimeZoneId = "EventTimeZoneId" };
            var sut = new EventViewModel(@event);

            Assert.Equal(sut.CampaignId, campaign.Id);
            Assert.Equal(sut.CampaignName, campaign.Name);
            Assert.Equal(sut.TimeZoneId, @event.TimeZoneId);
        }
开发者ID:stevejgordon,项目名称:allReady,代码行数:10,代码来源:EventViewModelShould.cs


示例15: LoadTestData

        protected override void LoadTestData()
        {
            var campaign = new Campaign
            {
                Id = 111,
                ManagingOrganization = new Organization()
            };

            Context.Campaigns.Add(campaign);

            Context.SaveChanges();
        }
开发者ID:nicolastarzia,项目名称:allReady,代码行数:12,代码来源:CampaignSummaryQueryHandlerShould.cs


示例16: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();

            var seattlePostalCode = new PostalCodeGeo { City = "Seattle", PostalCode = "98117", State = "WA" };
            var seattle = new Location
            {
                Id = 1,
                Address1 = "123 Main Street",
                Address2 = "Unit 2",
                City = "Seattle",
                PostalCode = seattlePostalCode,
                Country = "USA",
                State = "WA",
                Name = "Organizer name",
                PhoneNumber = "555-555-5555"                            
            };
         

            var htb = new Organization
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };
            htb.Campaigns.Add(firePrev);

            var queenAnne = new Event
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<EventSkill>()
            };

            context.PostalCodes.Add(seattlePostalCode);
            context.Locations.Add(seattle);
            context.Organizations.Add(htb);
            context.Events.Add(queenAnne);
            context.SaveChanges();
        }
开发者ID:pottereric,项目名称:allReady,代码行数:52,代码来源:EventDetailQueryHandlerTests.cs


示例17: HandleReturnsCorrectCampaign

        public void HandleReturnsCorrectCampaign()
        {
            var message = new CampaignByCampaignIdQuery { CampaignId = 1 };
            var campaign = new Campaign { Id = message.CampaignId };

            var mockedDataAccess = new Mock<IAllReadyDataAccess>();
            mockedDataAccess.Setup(m => m.GetCampaign(message.CampaignId)).Returns(campaign);

            var sut = new CampaignByCampaignIdQueryHandler(mockedDataAccess.Object);
            var result = sut.Handle(message);

            Assert.Same(campaign, result);
        }
开发者ID:joelhulen,项目名称:allReady,代码行数:13,代码来源:CampaginByCampaignIdQueryHandlerTests.cs


示例18: LoadTestData

        protected override void LoadTestData()
        {
            var context = ServiceProvider.GetService<AllReadyContext>();
            var htb = new Organization()
            {
                Name = "Humanitarian Toolbox",
                LogoUrl = "http://www.htbox.org/upload/home/ht-hero.png",
                WebUrl = "http://www.htbox.org",
                Campaigns = new List<Campaign>()
            };

            var firePrev = new Campaign()
            {
                Name = "Neighborhood Fire Prevention Days",
                ManagingOrganization = htb
            };

            var queenAnne = new Activity()
            {
                Id = 1,
                Name = "Queen Anne Fire Prevention Day",
                Campaign = firePrev,
                CampaignId = firePrev.Id,
                StartDateTime = new DateTime(2015, 7, 4, 10, 0, 0).ToUniversalTime(),
                EndDateTime = new DateTime(2015, 12, 31, 15, 0, 0).ToUniversalTime(),
                Location = new Location { Id = 1 },
                RequiredSkills = new List<ActivitySkill>(),
            };

            var username1 = $"[email protected]";
            var username2 = $"[email protected]";

            var user1 = new ApplicationUser { UserName = username1, Email = username1, EmailConfirmed = true };
            context.Users.Add(user1);
            var user2 = new ApplicationUser { UserName = username2, Email = username2, EmailConfirmed = true };
            context.Users.Add(user2);

            htb.Campaigns.Add(firePrev);            
            context.Organizations.Add(htb);
            context.Activities.Add(queenAnne);

            var activitySignups = new List<ActivitySignup>
            {
                new ActivitySignup { Activity = queenAnne, User = user1, SignupDateTime = DateTime.UtcNow },
                new ActivitySignup { Activity = queenAnne, User = user2, SignupDateTime = DateTime.UtcNow }
            };

            context.ActivitySignup.AddRange(activitySignups);
            context.SaveChanges();
        }
开发者ID:ultrabert,项目名称:allReady,代码行数:50,代码来源:MessageVolunteers.cs


示例19: Edit

        public async Task<IActionResult> Edit(Campaign campaign)
        {
            if (!UserIsTenantAdminOfCampaign(campaign))
            {
                return new HttpUnauthorizedResult();
            }

            if (ModelState.IsValid)
            {
                await _dataAccess.UpdateCampaign(campaign);
                return await Task.FromResult(RedirectToAction("Index", new { area = "Admin" }));
            }
            return await Task.FromResult(View(campaign));
        }
开发者ID:garrmark,项目名称:allReady,代码行数:14,代码来源:CampaignAdminController.cs


示例20: CampaignViewModel

        public CampaignViewModel(Campaign campaign)
        {
            if (campaign == null)
                return;

            Id = campaign.Id;
            Name = campaign.Name;
            Description = campaign.Description;
            ManagingTenantName = campaign.ManagingTenant.Name;
            ManagingTenantId = campaign.ManagingTenant.Id;
            StartDate = new DateTimeOffset(campaign.StartDateTimeUtc, TimeSpan.Zero);
            EndDate = new DateTimeOffset(campaign.EndDateTimeUtc, TimeSpan.Zero);
            Activities = campaign.Activities != null ? campaign.Activities.ToViewModel() : Enumerable.Empty<ActivityViewModel>();
        }
开发者ID:modulexcite,项目名称:allReady,代码行数:14,代码来源:CampaignViewModel.cs



注:本文中的AllReady.Models.Campaign类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Models.Event类代码示例发布时间:2022-05-24
下一篇:
C# Models.ApplicationUser类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap