コード例 #1
0
        public Task <HttpResponseMessage> Get(Guid videoId)
        {
            HttpStatusCode httpStatusCode;
            VideoViewModel video = null;

            try
            {
                video = _videoAppService.GetById(videoId);

                if (video == null)
                {
                    httpStatusCode = HttpStatusCode.NotFound;
                }
                else
                {
                    httpStatusCode = HttpStatusCode.OK;
                }
            }
            catch (Exception e)
            {
                httpStatusCode = HttpStatusCode.InternalServerError;
            }

            HttpResponseMessage httpResponseMessage        = Request.CreateResponse(httpStatusCode, video);
            TaskCompletionSource <HttpResponseMessage> tsc = new TaskCompletionSource <HttpResponseMessage>();

            tsc.SetResult(httpResponseMessage);
            return(tsc.Task);
        }
コード例 #2
0
ファイル: VideosController.cs プロジェクト: gikka/Facilis
        // GET: Videos/Details/5
        public ActionResult Details(int id)
        {
            var video          = _videoApp.GetById(id);
            var videoViewModel = Mapper.Map <Video, VideoViewModel>(video);

            return(View(videoViewModel));
        }