public void Put(int id, [FromBody] CompanyEvent value)
        {
            //var old = CompanyEventsDataContext.Events.Single(x => x.Id == id);
            var old = CompanyEventsDataContext.Events[id];

            if (old != null)
            {
                CompanyEventsDataContext.Events.Remove(CompanyEventsDataContext.Events.Single(x => x.Id == id));
                CompanyEventsDataContext.Events.Add(value);
            }
        }
        /// <summary>
        /// Publishes an EchoEvent.
        /// </summary>
        /// <param name="request">The data to be echo'd back to the client</param>
        /// <returns>The data sent by the client</returns>
        private ServiceBusResponse companySearch(CompanySearchRequest request)
        {
            CompanyEvent companyEvent = new CompanyEvent
            {
                data     = request.searchDeliminator,
                username = username
            };

            SendOptions sendOptions = new SendOptions();

            sendOptions.SetDestination("Company");



            return(requestingEndpoint.Request <ServiceBusResponse>(request, sendOptions).
                   ConfigureAwait(false).GetAwaiter().GetResult());
        }
Exemplo n.º 3
0
        public static IBotAction Create(DialogFlowResult result, CompanyEvent companyEvent)
        {
            switch (result.action.ToLower())
            {
            case "event.dates":
                return(new EventDatesAction(companyEvent, result.parameters["date-type"]));

            case "event.location":
                return(new EventLocationAction(companyEvent, result.parameters["place-type"]));

            case "event.registration.costs":
                return(new EventCostsAction(companyEvent));

            case "event.registration.dates":
                return(new EventRegistrationAction(companyEvent, result.parameters["Event-Dates"]));

            default:
                throw new Exception();
            }
        }
        protected override void Seed(ComplexRelationshipContext context)
        {
            //Table that has a many to many relationship with itself
            var johnSmith = new Person {
                Name = "John Smith", Friends = new List <Person>()
            };
            var joeBlow = new Person {
                Name = "Joe Blow", Friends = new List <Person>()
            };
            var paulHart = new Person {
                Name = "Paul Hart", Friends = new List <Person>()
            };

            johnSmith.Friends.Add(joeBlow);
            johnSmith.Friends.Add(paulHart);

            context.People.Add(johnSmith);

            //Save to call the save function here in order to have person ids since the order of execution cannot be forced in EF
            context.SaveChanges();

            //Standard many to many relationships
            var aBigEvent = new CompanyEvent {
                Name = "The big event"
            };

            aBigEvent.PeopleInvited.AddRange(new[] {
                johnSmith, joeBlow, paulHart
            });

            johnSmith.AcceptedInvitations.Add(aBigEvent);
            joeBlow.DeclinedInvitations.Add(aBigEvent);

            context.CompanyEvents.Add(aBigEvent);

            context.SaveChanges();
        }
Exemplo n.º 5
0
 public EventLocationAction(CompanyEvent companyEvent, string placeType) : base(companyEvent)
 {
     _placeType = placeType ?? "";
 }
 public void Post([FromBody] CompanyEvent value)
 {
     value.Id = Math.Max(1, CompanyEventsDataContext.Events.Max(x => x.Id));
     CompanyEventsDataContext.Events.Add(value);
 }
Exemplo n.º 7
0
 public EventAction(CompanyEvent companyEvent)
 {
     _companyEvent = companyEvent;
 }
Exemplo n.º 8
0
 public EventDatesAction(CompanyEvent companyEvent, string dateType) : base(companyEvent)
 {
     _dateType = dateType ?? "";
 }
Exemplo n.º 9
0
 public EventCostsAction(CompanyEvent companyEvent) : base(companyEvent)
 {
 }
Exemplo n.º 10
0
 public EventRegistrationAction(CompanyEvent companyEvent, string dateType) : base(companyEvent)
 {
     _dateType = dateType ?? "";
 }
Exemplo n.º 11
0
 public EventBot(int eventId)
 {
     //companyEvent = CompanyEventsDataContext.Events.Single(x => x.Id == eventId);
     companyEvent = CompanyEventsDataContext.Events[eventId];
 }