public HttpResponseMessage Get(int fileId) { var file = _uploadFileRepository.Get(fileId); var path = _fileSystemPathService.GetImageSavePath() + file.Name; var result = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(File.ReadAllBytes(path)) }; result.Content.Headers.ContentType = new MediaTypeHeaderValue("image/*"); return(result); }
public Result DeletePicture(int id) { var file = _uploadFileRepository.Get(id); _uploadFileRepository.DeleteFile(id); var path = _fileSystemPathService.GetImageSavePath() + file.Name; File.Delete(path); return(new Result { Message = "Deleted.", Status = "Success" }); }
public UploadFile getUploadFile(string serial) { return(uploadRepo.Get(t => t.Serial.Equals(serial))); }