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(); }
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(); }
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(); }