// public processDelete static public Task <ActionResult> ProcessDelete <T>(IIdentity user, HttpRequest uriInfo, DbContext entityManager, String serviceName) where T : class { return(RequestFilter.GetObject <T>(user, uriInfo, entityManager, serviceName).ContinueWith <ActionResult>(taskGet => { return DbUtils.DeleteOne <T>(entityManager, taskGet.Result).ContinueWith <ActionResult>((taskObjDeleted) => { RequestFilter.Notify(taskObjDeleted.Result, serviceName, true); return Response.Ok(); }, TaskContinuationOptions.NotOnFaulted).Result; }, TaskContinuationOptions.NotOnFaulted)); }
// public processUpdate static public Task <ActionResult> ProcessUpdate <T>(IIdentity user, HttpRequest uriInfo, DbContext entityManager, String serviceName, T obj) where T : class { return(RequestFilter.GetObject <T>(user, uriInfo, entityManager, serviceName).ContinueWith <ActionResult>(taskGet => { ActionResult response = CheckObjectAccess(user, serviceName, obj); if (response != null) { return response; } entityManager.Entry(taskGet.Result).State = EntityState.Detached; return DbUtils.Update <T>(null, entityManager, obj).ContinueWith <ActionResult>(taskNewObj => { RequestFilter.Notify(taskNewObj.Result, serviceName, false); return Response.Ok(taskNewObj.Result); }, TaskContinuationOptions.NotOnFaulted).Result; }, TaskContinuationOptions.NotOnFaulted)); }
// public processRead static public Task <ActionResult> ProcessRead <T>(IIdentity user, HttpRequest uriInfo, DbContext entityManager, String serviceName) where T : class { return(RequestFilter.GetObject <T>(user, uriInfo, entityManager, serviceName).ContinueWith <ActionResult>(taskGet => { return Response.Ok(taskGet.Result); }, TaskContinuationOptions.NotOnFaulted)); }