示例#1
0
        /// <summary>
        /// Asks the service to asynchronously retrieve a single echo uniquely identified through id.
        /// </summary>
        /// <param name="id">
        /// The echos unique identifier.
        /// </param>
        /// <returns>
        /// HTTP Status Code 200 - OK + JSON encoded data payload on success,
        ///     HTTP Status Code 404 - Not Found if no data was retrieved,
        ///     HTTP Status Code 500 - Internal Server Error if the other codes don't apply. Contains exception on DEBUG.
        /// </returns>
        public async Task <IHttpActionResult> Get(int id)
        {
            var result = await _echoService.GetByIdAsync(id);

            if (result.ActionStatus.Status == ActionStatusEnum.Success)
            {
                return(GetHttpActionResult(result.ActionData));
            }

            return(HandleErrorActionResult(result));
        }