public IHttpActionResult Post([FromBody] object parameter) { // object does not work //var anonyType = new { }; //string resultBody = JsonConvert.SerializeObject(parameter); //resultBody = resultBody.Replace("{", ""); //resultBody = resultBody.Replace("}", ""); //var para = JsonConvert.DeserializeAnonymousType(resultBody, anonyType); // must include a ObjType = "UserGroup" in parameter object string objType = MapClass <AppClass> .ObjType(parameter); if (objType == "") { return(BadRequest("Object is null.")); } var action = new ActionApp <AppClass>(); string result = action.ActionsObj(objType, parameter); if (result == "Failed") { return(new ReturnMessage("Add Object Content to Database Failed", Request)); } else { return(Ok(result)); } }
public IHttpActionResult Delete([FromBody] object parameter) { // object does not work // must include a ObjType = "UserGroup" in parameter object string objType = MapClass <AppClass> .ObjType(parameter); if (objType == "") { return(BadRequest("Object is null.")); } var action = new ActionApp <AppClass>(); string result = action.ActionsObj(objType, parameter); if (result == "Failed") { return(new ReturnMessage("Delete Object Content in Database Failed", Request)); } else { return(Ok(result)); } }