public HttpResponseMessage GetArticleFile(GetArticleFileDTO dto) { Components.Entities.File f = _repository.Get(dto.fileId, dto.articleId); if (f == null) { var fi = FileManager.Instance.GetFile(dto.fileId); if (fi != null) { f = new Components.Entities.File { ArticleID = dto.articleId, FileID = fi.FileId, fileInfo = fi, IsImage = CommonHelper.FileIsImage(fi), SortOrder = -1 }; } } if (f != null) { var fvm = Mapper.Map <Components.Entities.File, FileViewModel>(f); return(Request.CreateResponse(fvm)); } else { return(Request.CreateResponse(System.Net.HttpStatusCode.NoContent)); } }
// GET: api/File public IHttpActionResult Get(string id) { return(Ok(_fileRepo.Get(id))); }