Ejemplo n.º 1
0
        /// <summary>
        /// Get event by id
        /// </summary>
        /// <param name="id"></param>
        /// <param name="tr"></param>
        /// <returns></returns>
        public EventDto GetEventById(int?id, out Treatment tr)
        {
            tr = new Treatment();

            if (!id.HasValue)
            {
                tr.AddFatalErrorWithCode(HttpStatusCode.BadRequest);
                return(null);
            }

            var foundEvent = _eventDao.GetEventById(id.Value);

            if (foundEvent == null)
            {
                tr.AddErrorWithCode(HttpStatusCode.NotFound);
                return(null);
            }

            var eventDto = EventDto.Extract(foundEvent);

            tr.AddObject(eventDto);

            return(eventDto);
        }