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); }
// GET: Videos/Details/5 public ActionResult Details(int id) { var video = _videoApp.GetById(id); var videoViewModel = Mapper.Map <Video, VideoViewModel>(video); return(View(videoViewModel)); }