当前位置: 首页>>代码示例>>C#>>正文


C# Models.Dinner类代码示例

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


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

示例1: Create

 public ActionResult Create()
 {
     Dinner dinner = new Dinner(){
         EventDate=DateTime.Now.AddDays(7)
     };
     return View(new DinnerFormViewModel(dinner));
 }
开发者ID:dnhieu92,项目名称:NerdDinner,代码行数:7,代码来源:DinnersController.cs

示例2: AddDeleteTest

        public void AddDeleteTest()
        {
            var dinner = new Dinner()
                                {
                                    Address = "address",
                                    ContactPhone = "244-444-5555",
                                    Country = "USA",
                                    Description = "test dinner",
                                    DinnerID = -1,
                                    EventDate = DateTime.Now.AddDays(1),
                                    HostedBy = "host",
                                    Latitude = 1.222,
                                    Longitude = 3.998,
                                    Title = "Test Dinner"
                                };
            repos.Add(dinner);
            repos.Save();
            Assert.AreEqual(12, repos.FindAllDinners().Count());

            var result = repos.FindUpcomingDinners().ToList();
            Assert.AreEqual("Test Dinner", result.ToArray()[0].Title);

            repos.Delete(dinner);
            repos.Save();
            Assert.AreEqual(11, repos.FindAllDinners().Count());
        }
开发者ID:nakaji,项目名称:NerdDinner,代码行数:26,代码来源:DinnerRepositoryTest.cs

示例3: Delete

 public void Delete(Dinner dinner)
 {
     foreach (var rsvp in dinner.RSVPs) {
         entities.RSVPs.DeleteObject(rsvp);
     }
     entities.Dinners.DeleteObject(dinner);
 }
开发者ID:craigpfau,项目名称:Nerd-Dinner,代码行数:7,代码来源:DinnerRepository.cs

示例4: CreateTestDinners

        public static List<Dinner> CreateTestDinners()
        {
            List<Dinner> dinners = new List<Dinner>();

            for (int i = 1; i <= 100; i++)
            {

                Dinner sampleDinner = new Dinner()
                                      {
                                              Title = "Sample Dinner",
                                              HostedBy = "SomeUser",
                                              Address = "California",
                                              Country = "USA",
                                              ContactPhone = "425-555-1212",
                                              Description = "Some description",
                                              EventDate = DateTime.Now.AddDays(i),
                                              Latitude = 99,
                                              Longitude = -99
                                      };

                RSVP rsvp = new RSVP();
                rsvp.AttendeeName = "SomeUser";
                sampleDinner.AddRsvp(rsvp);

                dinners.Add(sampleDinner);
            }

            return dinners;
        }
开发者ID:alberto,项目名称:altnerddinner,代码行数:29,代码来源:FakeDinnerData.cs

示例5: CreateTestDinners

        List<Dinner> CreateTestDinners()
        {

            List<Dinner> dinners = new List<Dinner>();

            for (int i = 0; i < 101; i++)
            {

                Dinner sampleDinner = new Dinner()
                {
                    DinnerID = i,
                    Title = "Sample Dinner",
                    HostedBy = "SomeUser",
                    Address = "Some Address",
                    Country = "USA",
                    EventDate = DateTime.Now.AddDays(i),
                    Latitude = 99,
                    Longitude = -99
                };

                dinners.Add(sampleDinner);
            }

            return dinners;
        }
开发者ID:brntsllvn,项目名称:NerdDinner,代码行数:25,代码来源:DinnersControllerTest.cs

示例6: Create

        public ActionResult Create(Dinner dinner)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    dinner.HostedBy = User.Identity.Name;

                    var rsvp = new RSVP();
                    rsvp.AttendeeName = User.Identity.Name;
                    dinner.RSVPs.Add(rsvp);

                    dinnerRepository.Add(dinner);
                    dinnerRepository.Save();

                    return RedirectToAction("Details", new {id = dinner.DinnerID});
                }
                catch
                {
                    ModelState.AddModelErrors(dinner.GetRuleViolations());
                }
            }

            return View(new DinnerFormViewModel(dinner));
        }
开发者ID:darrencauthon,项目名称:MvcTurbineExamplesNerdDinner,代码行数:25,代码来源:DinnersController.cs

示例7: CreateTestDinners

        public static Tuple<List<Dinner>, List<Event>> CreateTestDinners()
        {
            List<Dinner> dinners = new List<Dinner>();
            List<Event> events = new List<Event>();

            for (int i = 1; i <= 101; i++)
            {

                Dinner sampleDinner = new Dinner()
                {
                    DinnerID = i,
                    DinnerGuid = Guid.NewGuid(),
                    Title = "Sample Dinner",
                    HostedBy = "SomeUser",
                    Address = "Some Address",
                    Country = "USA",
                    ContactPhone = "425-555-1212",
                    Description = "Some description",
                    EventDate = DateTime.Now.AddDays(i),
                    Latitude = 99,
                    Longitude = -99
                };
                dinners.Add(sampleDinner);

                var e = new Event();
                e.Data = @"{""Name"":""SomeUser"",""FriendlyName"":""SomeUser""}";
                e.EventType = "NerdDinner.Events.RSVPed";
                e.DateTime = DateTime.UtcNow;
                e.AggregateId = sampleDinner.DinnerGuid;
                events.Add(e);
            }

            return Tuple.Create(dinners, events);
        }
开发者ID:jbijlsma,项目名称:coding-dojo-event-sourcing,代码行数:34,代码来源:FakeDinnerData.cs

示例8: Index

 public ActionResult Index(int dinnerCount = 100)
 {
     const string name = "Nerd";
     var membershipService = new AccountMembershipService();
     if(membershipService.ValidateUser(name, "password") == false) {
         membershipService.CreateUser(name, "password", "[email protected]");
     }
     var repo = new DinnerRepository();
     foreach(var d in repo.All) {
         repo.Delete(d.DinnerID);
     }
     for (var i = 0; i < dinnerCount; i++) {
         var dinner = new Dinner {Title = "Nerd-Out",
                                  Description = "Nerding out with the nerds",
                                  EventDate = DateTime.Now.Add(new TimeSpan(30, 0, 0, 0)),
                                  ContactPhone = "403-999-9999",
                                  Address = "Calgary, AB",
                                  Country = "Canada",
                                  HostedById = name,
                                  HostedBy = name};
         var rsvp = new RSVP {AttendeeNameId = name, AttendeeName = name};
         dinner.RSVPs = new List<RSVP> {rsvp};
         repo.InsertOrUpdate(dinner);
     }
     try {
         repo.Save();
     }
     catch(DbEntityValidationException e) {
         var error = e.EntityValidationErrors.First().ValidationErrors.First();
         return new ContentResult {Content = string.Format("{0}: {1}", error.PropertyName, error.ErrorMessage)};
     }
     return new ContentResult{Content = "Success"};
 }
开发者ID:JetBrains,项目名称:dottrace-demos,代码行数:33,代码来源:SeedDataController.cs

示例9: Delete

 public void Delete(Dinner dinner)
 {
     foreach (var rsvp in dinner.RSVPs)
     {
         _entities.RSVPs.Remove(rsvp);
     }
     _entities.Dinners.Remove(dinner);
 }
开发者ID:MPogson,项目名称:NerdDinner,代码行数:8,代码来源:DinnerRepository.cs

示例10: Delete

        public void Delete(Dinner dinner)
        {
            //foreach (RSVP rsvp in dinner.RSVPs.ToList())
            //    db.RSVPs.DeleteObject(rsvp);
            //db.Dinners.DeleteObject(dinner);
            var roi = new RiakObjectId(DinnerBucket, dinner.DinnerID);

            _client.Delete(roi);
        }
开发者ID:peschkaj,项目名称:RiakNerdDinner,代码行数:9,代码来源:DinnerRepository.cs

示例11: Add

        public void Add(Dinner dinner)
        {
            EnsureTransaction();

            if (!dinner.IsValid)
                throw new ApplicationException("Rule violations prevent saving");

            session.Save(dinner);
        }
开发者ID:nagor,项目名称:Glimpse,代码行数:9,代码来源:NHibernateDinnerRepository.cs

示例12: Save

        public void Save(Dinner dinner)
        {
            if (!dinner.IsValid)
            {
                throw new ApplicationException("Rule violations");
            }

            _session.SaveOrUpdate(dinner);
        }
开发者ID:alberto,项目名称:altnerddinner,代码行数:9,代码来源:NhDinnerRepository.cs

示例13: Create

        public ActionResult Create()
        {
            var dinner = new Dinner()
            {
                EventDate = DateTime.Now.AddDays(7),
                HostedBy = User.Identity.Name
            };

            return View(dinner);
        }
开发者ID:joobn72,项目名称:CQRSWorkshop,代码行数:10,代码来源:DinnersController.cs

示例14: Create

        public ActionResult Create(Dinner dinner)
        {
            if (ModelState.IsValid)
            {
                var command = new HostDinner(User.Identity.Name);
                new HostDinnerCommandHandler().Handle(command, dinner, db);

                return RedirectToAction("Index");
            }

            return View(dinner);
        }
开发者ID:joobn72,项目名称:CQRSWorkshop,代码行数:12,代码来源:DinnersController.cs

示例15: Create

        public ActionResult Create(Dinner dinner)
        {
            if (ModelState.IsValid)
            {
                var command = new HostDinner(new DinnerId(dinner.DinnerID), User.Identity.Name, dinner.Title, dinner.EventDate, dinner.Description, dinner.ContactPhone, dinner.Address, dinner.Country);
                new HostDinnerApplicationService(db).When(command);

                return RedirectToAction("Index");
            }

            return View(dinner);
        }
开发者ID:joobn72,项目名称:CQRSWorkshop,代码行数:12,代码来源:DinnersController.cs


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