using System; using System.IO; namespace FileRepository.Models { /// /// This model serves to represent the files being stored. /// public class RepoFile { /// /// Gets or sets the id field for the file, this serves as the key field/unique identifier. /// public string Id { get; set; } /// /// Gets or sets the actual file name of the file. /// 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 id of the file. /// The filename of the file. /// The content of the file. /// Returns an initialised File object. public RepoFile GenerateFile(string id, string fileName, Stream content) { RepoFile newFile = new RepoFile() { Id = id, FileName = fileName, Content = content, Created = DateTime.Now, }; return newFile; } } }