예제 #1
0
        public Task <HttpResponseMessage> Delete(Guid videoId)
        {
            HttpStatusCode httpStatusCode;
            object         videoToBeDeleted = new object();

            try
            {
                videoToBeDeleted = _videoAppService.GetById(videoId);

                if (videoToBeDeleted == null)
                {
                    httpStatusCode = HttpStatusCode.NotFound;
                }
                else
                {
                    _videoAppService.Remove(videoId);
                    httpStatusCode = HttpStatusCode.OK;
                }
            }
            catch (Exception e)
            {
                httpStatusCode = HttpStatusCode.InternalServerError;
            }

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

            tsc.SetResult(httpResponseMessage);
            return(tsc.Task);
        }
예제 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            var video = _videoApp.GetById(id);

            _videoApp.Remove(video);

            return(RedirectToAction("Edit", "Eventos", new { id = video.EventoId }));
        }