/// <summary> /// Get one event with event name in JSON format /// </summary> /// <param name="name"></param> /// <returns></returns> public Response GetEvent(string eid) { Response response = new Response(); var _event = MarkLogicLayer.getEventMLById(eid); //var _event = events.FirstOrDefault((p)=> p.EventName == name); if (_event == null) { response.errorCode = 404; response.errorText = "EVENT_NOT_FOUND"; } else { response.payload = _event; } return(response); }
public Response registerAttendance([FromBody] dynamic values) { /* { * "pid" : "" , "eid" : "" * } */ String pid = values.pid; // personId String eid = values.eid; // eventId Response response = new Response(); //JObject eventJson = MarkLogicLayer.getEventMLById(eid); Event eventObject = JsonConvert.DeserializeObject <Event>(MarkLogicLayer.getEventMLById(eid).ToString()); List <string> attendees = eventObject.Attendees.ToList(); if (!attendees.Contains(pid)) { attendees.Add(pid); } eventObject.Attendees = attendees.ToArray(); MarkLogicLayer.putEvent(eventObject); Person personObject = JsonConvert.DeserializeObject <Person>(MarkLogicLayer.getPersonMLById(pid).ToString()); List <string> eventList = personObject.EventList.ToList(); if (!eventList.Contains(eid)) { eventList.Add(eid); } personObject.EventList = eventList.ToArray(); MarkLogicLayer.putPerson(personObject); JObject jsonPayload = JObject.FromObject(eventObject); response.payload = jsonPayload; return(response); }