// GET api/projects/{id}/avsx public async Task <HttpResponseMessage> Get(string id) { // Get project await GetProjectAsync(id); // Get avsx DomainAvsx avsx = await _projectAvsxService.GetAsync(id); if (avsx == null) { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ResponseMessages.ResourceNotFound)); } var responseAvsx = new ProjectAvsx { Name = avsx.FileName, Uri = avsx.FileUri, Length = avsx.FileLength, ContentType = avsx.ContentType }; HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, responseAvsx); response.SetLastModifiedDate(avsx.Modified); return(response); }
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; }
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); }
// GET api/projects/{id}/avsx public async Task<HttpResponseMessage> Get(string id) { // Get project await GetProjectAsync(id); // Get avsx DomainAvsx avsx = await _projectAvsxService.GetAsync(id); if (avsx == null) { return Request.CreateErrorResponse(HttpStatusCode.NotFound, ResponseMessages.ResourceNotFound); } var responseAvsx = new ProjectAvsx { Name = avsx.FileName, Uri = avsx.FileUri, Length = avsx.FileLength, ContentType = avsx.ContentType }; HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, responseAvsx); response.SetLastModifiedDate(avsx.Modified); return response; }