Beispiel #1
0
 public Event(Event evnt)
 {
     Date = evnt.Date;
     Description = evnt.Description;
     Title = evnt.Title;
     Time = evnt.Time;
     EventRoute = evnt.EventRoute;
     Location = evnt.Location;
 }
Beispiel #2
0
        public SingleModelResponse<Event> UpdateEvent(EventViewModel evnt)
        {
            string saveUrl = EventUri + "Update/EditEvent";
            List<EventRoute> newRoutes = new List<EventRoute>();
            char numLet = 'A';
            foreach (EventRouteViewModel evntRoute in evnt.EventRoutes)
            {
                EventRoute route = new EventRoute(DateTime.Now.ToString());
                route.Title = evnt.Title+' '+numLet;
                numLet++;
                route.Description = evnt.Description;
                route.Distance = evntRoute.Distance;
                route.RouteID = evntRoute.RouteId;
                route.EventID = evnt.EventId;
                newRoutes.Add(route);
            }

            var newEvent = new Event
            {
                EventId = evnt.EventId,
                Date = evnt.Date,
                Time = evnt.Time,
                Description = evnt.Description,
                DateCreated = evnt.DateCreated,
                DateModified = DateTime.Now.ToString(),
                Location = evnt.Location,
                Title = evnt.Title,
                EventRoute = newRoutes
            };
            var updatedEvent = PutContent(saveUrl, newEvent);
            return updatedEvent;
        }
Beispiel #3
0
        public SingleModelResponse<Event> SaveEvent(EventViewModel evnt)
        {
            string saveUrl = EventUri + "SaveEvent";
            List<EventRoute> newRoutes = new List<EventRoute>();
            foreach (EventRouteViewModel evntRoute in evnt.EventRoutes)
            {
                EventRoute route = new EventRoute(DateTime.Now.ToString());
                route.Title = evntRoute.Title;
                route.Description = evntRoute.Description;
                route.RouteID = evntRoute.RouteId;
                route.Distance = evntRoute.Distance;
                route.EventID = evnt.EventId;
                newRoutes.Add(route);
            }

            var newEvent = new Event
            {
                UserID = evnt.UserID,
                Date = evnt.Date,
                ClubID = evnt.ClubId,
                Time = evnt.Time,
                DateCreated=DateTime.Now.ToString(),
                Description = evnt.Description,
                Location = evnt.Location,
                Title = evnt.Title,
                EventRoute = newRoutes
            };
            var createdEvent = PostContent(saveUrl, newEvent);
            return createdEvent;
        }