In my action, I have an error like System.MissingMethodException when I use TryUpdateModel. I use this in several places in my controller without any problems, so what does this mean a problem with my model?
In this case, I am using a derived class from my domain.
public class TypeOperationDisplay : TypeOperation
{
public TypeOperationDisplay(TypeOperation to)
{
Id = to.Id;
Code = to.Code;
Libelle = to.Libelle;
LibelleSaisie = to.LibelleSaisie;
}
[ScaffoldColumn(false)]
public override long Id
{
get
{
return base.Id;
}
set
{
base.Id = value;
}
}
[HtmlPropertiesAttribute(MaxLength=255, Size=50, ReadOnly=true)]
[DisplayName("")]
public override string Code
{
get
{
return base.Code;
}
set
{
base.Code = value;
}
}
}
TypeOperation is created. I get this class to add attributes, and I use this in my model.
public class DetailTypeOperationModel : ViewModelBase
{
public Int64 IdTypeOperation { get; set; }
public TypeOperationDisplay TypeOperationDisplay { get; set; }
}
To show I use this action
public ActionResult AfficheDetailTypeOperation(Int64 idTypeOperation)
{
DetailTypeOperationModel d = new DetailTypeOperationModel
{
IdTypeOperation = idTypeOperation,
TypeOperationDisplay = _srvTypeOperation.Charger(idTypeOperation).ToDisplay()
};
return View("GererTypeOperation", d);
}
To receive sent data
[HttpPost]
public ActionResult ModifieTypeOperation(Int64 idTypeOperation, FormCollection fc)
{
DetailTypeOperationModel d = new DetailTypeOperationModel();
TryUpdateModel<DetailTypeOperationModel>(d);
_srvTypeOperation.Modifier(d.TypeOperationDisplay);
return View("Index", new AdministrationModel());
}
And it is on this Action that I have a problem on TryUpdateModel. With step-by-step debugging, I don’t understand why this component caught the error and where is this missing method?
Thanks for the help:)
source
share