Retrieve other table 's data within a TableController - Azure Mobile App Service .NET backend

I created a custom Table controller called "TaskItemController" in Azure Mobile App Service .NET backend and needs to retrieve data from other tables. I using the code "context.TodoItems.SqlQuery" to retrieve data from "TodoItems" table. The variable "context" is initialized in method "Initialize(HttpControllerContext controllerContext)" within table controller.

The following is a sample code to retrieve data from other table "TodoItems".

// POST tables/TaskItem
 public async Task<IHttpActionResult> PostTaskItem(TaskItem item)
{
         var query = context.TodoItems.SqlQuery("Select * from TaskItems where Id='" + item.TaskId + "'").FirstOrDefault<TaskItem>();

         //Get data column's value
        var taskName=query.TaskName;
}

Comments

Popular posts from this blog

Top JavaScript courses helping you develop SPFx webPart with ReactJS and AngularJS

SharePoint 2013 error - "Application error when access /_vti_bin/client.svc"

Enable the Microsoft Power BI report file type (.pbix) in SharePoint Search