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