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

            // Add avsx
            var avsx = new DomainAvsx
            {
                ContentType = model.Avsx.ContentType,
                FileName = model.Avsx.Name,
                FileUri = model.Avsx.Uri,
                FileLength = model.Avsx.Length
            };

            avsx = await _projectAvsxService.AddAsync(id, avsx);

            var responseAvsx = new ProjectAvsx
            {
                Name = avsx.FileName,
                Uri = avsx.FileUri,
                Length = avsx.FileLength,
                ContentType = avsx.ContentType
            };

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, responseAvsx);

            response.SetLastModifiedDate(avsx.Modified);

            return response;
        }
Exemplo n.º 2
0
 // PUT api/projects/{id}/avsx
 public HttpResponseMessage Put(string id, ProjectAvsxModel model)
 {
     return Request.CreateErrorResponse(HttpStatusCode.MethodNotAllowed, ResponseMessages.MethodNotAllowed);
 }