Esempio n. 1
0
        private Dinner(HostDinner command)
        {
            CreateDinnerInDB(command);

            RaiseEvent(new DinnerCreated(command.Id, command.HostedBy, command.Title, command.EventDate,
                                         command.Description, command.ContactPhone, command.Address, command.Country));
        }
Esempio 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();
        }
        // End day four
        #endregion


        // ## No longer in use
        // # Property to get IsThursday value
        //public bool ThursdayChecked
        //{
        //    get { return days.IsThursday(); }
        //}
        #endregion

        #endregion

        // # Constructor
        public ViewModel()
        {
            #region Alex [RESERVATION]

            _reservations = Singelton.GetInstance().Reservations;
            Singelton.GetInstance().Reservations.Add(new Reservation(0, 0, 0, 0));

            #endregion

            #region Alex [CALCULATOR]

            _calculation = Singelton.GetInstance().Calculation;
            Singelton.GetInstance().Calculation.Add(new Calcualtor(0, 0, 0, 0));



            #endregion

            #region jacob

            _households    = Singelton.GetInstance().Households;
            _hostDinners   = Singelton.GetInstance().HostDinners;
            HAddCommand    = new RelayCommand(HAdd);
            HRemoveCommand = new RelayCommand(HRemove);
            HSaveCommand   = new RelayCommand(SaveHousehold);
            HLoadCommand   = new RelayCommand(LoadHousehold);
            DAddCommand    = new RelayCommand(DAdd);
            #endregion

            #region Henrik
            days = new CommunalEating.Models.Calendar();
            day1 = new HostDinner("Kødsovs", "Serveres med yadada", "Kan indeholde kød", "hans", 500, DateTime.Today);
            day2 = new HostDinner("En anden ret", "Serveres med yadada", "Kan indeholde kød", "hans", 500, DateTime.Today.AddDays(4));
            day3 = new HostDinner("En tredje ret", "Serveres med yadada", "Kan indeholde kød", "hans", 500, DateTime.Today.AddDays(5));
            day4 = new HostDinner("Og den sidste ret", "Serveres med yadada", "Kan indeholde kød", "hans", 500, DateTime.Today.AddDays(6));
            #endregion
        }
Esempio n. 4
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();
        }
Esempio n. 5
0
 public static Dinner HostDinner(HostDinner command)
 {
     return new Dinner(command);
 }
 public void When(HostDinner command)
 {
     Aggregates.Dinner.HostDinner(command, _db);
 }
 public void When(HostDinner command)
 {
     var dinner = Aggregates.Dinner.HostDinner(command);
     _repository.Save(dinner, Guid.NewGuid());
 }