Tag:Core custom webapi

  • ASP.NET Detailed explanation of core implementation of custom webapi model validation

    Time:2020-6-9

    Framework Era  In the framework era, when we generally conduct parameter verification, the following code is very common [HttpPost] public async Task<JsonResult> SaveNewCustomerAsnyc(AddCustomerInput input) { if (!ModelState.IsValid) { return Json(Result.FromCode(ResultCode.InvalidParams)); } ….. } Or the advanced point is to implement iactionfilter to intercept, as follows: public class ApiValidationFilter : IActionFilter { public bool AllowMultiple => […]