Ejemplo n.º 1
0
        public static void HostDinner(HostDinner command, Models.Dinner dinner, NerdDinnerContext db)
        {
            dinner.HostedBy = command.HostedBy;

            RSVP rsvp = new RSVP();
            rsvp.AttendeeName = command.HostedBy;

            dinner.RSVPs = new List<RSVP>();
            dinner.RSVPs.Add(rsvp);

            db.Dinners.Add(dinner);
            db.SaveChanges();
        }
Ejemplo n.º 2
0
        public static void HostDinner(HostDinner command, NerdDinnerContext db)
        {
            var dinner = new Models.Dinner
                {
                    DinnerID = command.Id.Id,
                    HostedBy = command.HostedBy,
                    Address = command.Address,
                    ContactPhone = command.ContactPhone,
                    Country = command.Country,
                    Description = command.Description,
                    EventDate = command.EventDate,
                    Title = command.Title
                };

            RSVP rsvp = new RSVP();
            rsvp.AttendeeName = command.HostedBy;

            dinner.RSVPs = new List<RSVP>();
            dinner.RSVPs.Add(rsvp);

            db.Dinners.Add(dinner);
            db.SaveChanges();
        }
Ejemplo n.º 3
0
        private static void CreateDinnerInDB(HostDinner command)
        {
            var db = new NerdDinnerContext();
            var dinner = new Models.Dinner
                {
                    Address = command.Address,
                    ContactPhone = command.ContactPhone,
                    Country = command.Country,
                    Description = command.Description,
                    DinnerID = command.Id.Id,
                    EventDate = command.EventDate,
                    HostedBy = command.HostedBy,
                    Title = command.Title
                };

            var rsvp = new RSVP();
            rsvp.AttendeeName = command.HostedBy;

            dinner.RSVPs = new List<RSVP>();
            dinner.RSVPs.Add(rsvp);

            db.Dinners.Add(dinner);
            db.SaveChanges();
        }
 public HostDinnerApplicationService(NerdDinnerContext db)
 {
     _db = db;
 }
 public void Handle(HostDinner command, Dinner dinner, NerdDinnerContext db)
 {
     Aggregates.Dinner.HostDinner(command, dinner, db);
 }