asp.net mvc - No parameterless constructor defined for this object. (Debug never reaches any controller action?) -
i hate these kind of errors.
i have asp.net core mvc form. when submit form dreaded "no parameterless constructor defined object." error.
i can't seem hit in debugger me find have went wrong.
my controller:
using brand.extensions; using brand.models; using microsoft.aspnetcore.http; using microsoft.aspnetcore.mvc; namespace brand.controllers { public class contentcontroller : controller { public iactionresult index() { return view(); } [httpget] public iactionresult upload() { return view(); } [httppost] [validateantiforgerytoken] public iactionresult upload(uploadedcontentmodel uploadedcontentmodel, formcollection formcollection, iformfilecollection uploadedfiles) { contentextensions contentextensions = new contentextensions(); fileextensions fileextensions = new fileextensions(); filemodel file = new filemodel(); file = fileextensions.getfilemodel(uploadedfiles["file"]); uploadedcontentmodel.file = fileextensions.uploadfile(file).id; filemodel thumbnail = new filemodel(); thumbnail = fileextensions.getfilemodel(uploadedfiles["thumbnail"]); uploadedcontentmodel.thumbnail = fileextensions.uploadfile(thumbnail).id; uploadedcontentmodel.id = contentextensions.uploadcontent(uploadedcontentmodel).id; return view(); } } }
my model:
public class uploadedcontentmodel { public guid id { get; set; } public string title { get; set; } public string description { get; set; } public guid file { get; set; } public guid thumbnail { get; set; } public string contenttype { get; set; } public string solutions { get; set; } public string industries { get; set; } public string additionaltags { get; set; } public datetime publish { get; set; } public datetime expire { get; set; } public string authorizedroles { get; set; } public string author { get; set; } public datetime created { get; set; } }
Comments
Post a Comment