Skip to content

SimplifyNet/Simplify.Web.Multipart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simplify.Web.Multipart

Nuget Version Nuget Download Build PackageLibraries.io dependency status for latest release CodeFactor Grade Platform PRs Welcome

Simplify.Web.Multipart is a package which provides multipart form view model and model binder for Simplify.Web web-framework.

Quick start

Registering binder

public void Configuration(IApplicationBuilder app)
{
    ...
    HttpModelHandler.RegisterModelBinder<HttpMultipartFormModelBinder>();
    ...
    app.UseSimplifyWeb();
}

public void ConfigureServices(IServiceCollection services)
{
    ...
    DIContainer.Current.RegisterHttpMultipartFormModelBinder();
    ...
}

Getting files from client

Asynchronous

public class MyController : ControllerAsync<MultipartViewModel>
{
    public override async Task<ControllerResponse> Invoke()
    {
        await ReadModelAsync();

        Model.Files
    }
}

Synchronous

Multipart files will be deserialized to the controller model on first model access

public class MyController : Controller<MultipartViewModel>
{
    public override ControllerResponse Invoke()
    {
        Model.Files
    }
}