我是 MVP 模式的新手。我不太清楚在哪里编写将文件上传到服务器的逻辑,然后在上传后执行一些验证步骤和数据库操作。请指教。
public interface IPresenter
{
void UploadFile(string fileName); //For simplicity, file name is passed;
//it can be declared as a property
}
public interface IDefaultView
{
void Upload();
}
public class DefaultPresenter : IPresenter
{
protected DefaultPresenter() {}
public DefaultPresenter(IDefaultView defaultview)
{
this.defaultView = defaultView;
}
public void UploadFile(string fileName)
{
//Do I need to write saving functionality here or call
//defaultView.Upload(fileName)?
//
//From online articles, I have seen all business functionality written here.
//But I think I will not be able to use System.Web in this layer.
}
}
public partial class UploadExtract: IDefaultView
{
public void Upload(fileName)
{
}
}