lundi 4 avril 2016

Web Api

My problem is very interesting. My code;

public JsonResult<ResultStatus> Post<T>(string query, [FromBody]T value) where T: GelYikaBase
    {

        return Json(new ResultStatus());
    }

I want to do with me, the only method to save any object of that database. But I do not know how to insert a function of the URLs in this way.

Please help me.

Error;

{"Message": "An error has occurred." 

"ExceptionMessage": "Cannot call action method 'System.Web.Http.Results.JsonResult1[GelYikaFreamwork.Data.ResultStatus] Post[T](System.String, T)' on controller 'Gel_Yıka_Servis.Controllers.ServisController' because the action method is a generic method." "ExceptionType": "System.InvalidOperationException" "StackTrace": " konum: System.Web.Http.Controllers.ReflectedHttpActionDescriptor.InitializeActionExecutor(MethodInfo methodInfo) konum: System.Web.Http.Controllers.ReflectedHttpActionDescriptor.<InitializeProperties>b__4() konum: System.Lazy1.CreateValue() konum: System.Lazy1.LazyInitValue() konum: System.Lazy1.get_Value() konum: System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken) --- Özel durumun oluşturulduğu önceki konumdan başlayan yığın izlemesinin sonu --- konum: System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) konum: System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) konum: System.Runtime.CompilerServices.TaskAwaiter1.GetResult() konum: System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext() --- Özel durumun oluşturulduğu önceki konumdan başlayan yığın izlemesinin sonu --- konum: System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) konum: System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) konum: System.Runtime.CompilerServices.TaskAwaiter1.GetResult() konum: System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() --- Özel durumun oluşturulduğu önceki konumdan başlayan yığın izlemesinin sonu --- konum: System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) konum: System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) konum: System.Runtime.CompilerServices.TaskAwaiter1.GetResult() konum: System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()" }




Aucun commentaire:

Enregistrer un commentaire