using System; using System.IO; namespace FileRepository.Models { /// /// This model serves to represent the files being stored. /// public class RepoFile { /// /// Gets or sets the actual file name of the file, this serves as the key field/unique identifier. /// public string Filename { get; set; } /// /// Gets or sets the contents of the file, as a stream for easy manipulation. /// public Stream Content { get; set; } /// /// Gets or sets the datetime object representing when this file object was created. /// public DateTime Created { get; set; } /// /// Initialise a File model based on passed parameters. /// /// The filename of the file. /// The content of the file. /// Returns an initialised File object. public RepoFile GenerateFile(string filename, Stream content) { RepoFile newFile = new RepoFile() { Filename = filename, Content = content, Created = DateTime.Now, }; return newFile; } } }