Hallo,
I have a Data Grid with create, update and destroy functions. I have and database too. My Controller code for create function is:
public ActionResult Anlage_Create([DataSourceRequest] DataSourceRequest request, MN_ANLAGE anlage)
{
if (this.ModelState.IsValid)
{
using (var anlagen = new TestEntities1())
{
var entity = new MN_ANLAGE {
ANLAGEID = anlage.ANLAGEID,
ANLAGEART = anlage.ANLAGEART,
ANLAGEBETREIBER = anlage.ANLAGEBETREIBER,
// ANLAGEDATA= anlage.ANLAGEDATA, ANLAGENAME=anlage.ANLAGENAME,
ANLAGENUMMER=anlage.ANLAGENUMMER,
ANLAGESTATUS=anlage.ANLAGESTATUS,
TESTBOX = anlage.TESTBOX
};
anlagen.MN_ANLAGE.Add(entity);
anlagen.SaveChanges();
anlage.ANLAGEID = entity.ANLAGEID;
}
}
return Json(new[] { anlage }.ToDataSourceResult(request, ModelState));
}
It is possible to get the properties dynamic from the database in the var entity = new Anlage? Now when i change the database i must to change this method.
Thank in advance!
Kind regards,
Milen