I working on blazor web application server side by csharp . I face issue i can't get values
of properties employee id and department code from object parameter to insert value on table
I get compile time error when try to get value for property employee ID as below
error CS1061: 'object' does not contain a definition for 'employeeID' and no accessible extension method 'employeeID' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
when check owner object after break point hit and data passed as below :
ValueKind = Object : "{"employeeID":1222,"employeeName":0,"departementCode":"211","jobCode":"1221","ownerType":null,"departementName":"ahmed"}"
[HttpPost]
public ActionResult AddOwnerFile(object owner)
{
string ownerfileno = owner.employeeID;
string departementCode = owner.departementCode;
var sql = "INSERT INTO Owner (OwnerFileNo, DepartementCode) VALUES ({0}, {1})";
var rowsAffected = _context.Database.ExecuteSqlRaw(sql, ownerfileno, departementCode);
return Ok();
}
so expected result will be
ownerfileno=1222
departementCode=211