Exemplo n.º 1
0
        public async Task<HttpResponseMessage> Post(string id, ExternalVideoModel model)
        {
            // Get project entity
            await GetProjectAsync(id);

            DomainExternalVideo externalVideo = await _externalVideoService.AddAsync(id, model);

            var result = new ExternalVideo
            {
                ProductName = externalVideo.ProductName,
                VideoUri = externalVideo.VideoUri,
                AcsNamespace = _settings.AcsNamespace
            };

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, result);
            return response;
        }
Exemplo n.º 2
0
        // GET api/projects/{id}/external
        public async Task<HttpResponseMessage> Get(string id)
        {
            // Get project
            await GetProjectAsync(id);

            // Get
            DomainExternalVideo externalVideo = await _externalVideoService.GetAsync(id);
            if (externalVideo == null)
            {
                return Request.CreateErrorResponse(HttpStatusCode.NotFound, ResponseMessages.ResourceNotFound);
            }

            var result = new ExternalVideo
            {
                ProductName = externalVideo.ProductName,
                VideoUri = externalVideo.VideoUri,
                AcsNamespace = _settings.AcsNamespace
            };

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, result);
            return response;
        }