How to return File type from method
<p>Is it possible to return <code>File</code> object from a method to <code>controller</code>?</p>

<p>Currently all logic is done in controller, so I got this: </p>

<pre><code>public ActionResult Download(Guid id){
    //some code to get file name, file stream and file content
    return File(fileStream, file.ContentType, file.Name);
}
</code></pre>

<p>But what I would like to get have in controller is:</p>

<pre><code>//this is in the controller
public ActionResult Download(Guid id){
    var file = GetFile(fileId);
    return file;
}
</code></pre>

<p>And this method with all information about file itself should be in service layer: </p>

<pre><code>//this is NOT in the controller
public File GetFile(Guid fileId){
    //some logic to get all stuff

    return File(fileStream, attachment.ContentType, attachment.Name);
}
</code></pre>

<p>However, I this case get message</p>

<blockquote>
  <p>"Non-invocable member 'File' cannot be used like method."</p>
</blockquote>

<p>Can I achieve this or should I forget that and stick with what I have now?</p>

<p><strong>EDIT:</strong> Suggested question does not answers my question!</p>

<p>I can download file, but I want in my controller to have a method which returns <code>File</code> type or whatever, and this method should be in another project in service layer. So this method should return file as object(), not stream, not file name or type. And in controller I would only call this method and return only what this method returns.</p>