-
Notifications
You must be signed in to change notification settings - Fork 5
/
ComplexItemController.cs
57 lines (47 loc) · 1.78 KB
/
ComplexItemController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using Microsoft.Azure.Mobile.Server;
using System.Configuration;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.OData;
using MobileAppDocDBOfflineSyncSampleService.DataObjects;
using MobileAppDocDBOfflineSyncSampleService.Helpers;
namespace MobileAppDocDBOfflineSyncSampleService.Controllers
{
public class ComplexItemController : TableController<ComplexItem>
{
protected override void Initialize(HttpControllerContext controllerContext)
{
base.Initialize(controllerContext);
string collectioName = ConfigurationManager.AppSettings["complexItemCollection"];
string databaseId = ConfigurationManager.AppSettings["databaseId"];
//Using Custom Domain Manager
DomainManager = new DocumentDBDomainManager<ComplexItem>(collectioName, databaseId, Request);//, Services);
}
[QueryableExpand("Nested")]
[QueryableExpand("NestedItems")]
public IQueryable<ComplexItem> GetAllTodoItems()
{
var q = Query();
return q;
}
public SingleResult<ComplexItem> GetTodoItem(string id)
{
return Lookup(id);
}
public Task<ComplexItem> PatchTodoItem(string id, Delta<ComplexItem> patch)
{
return UpdateAsync(id, patch);
}
public async Task<IHttpActionResult> PostTodoItem(ComplexItem item)
{
ComplexItem current = await InsertAsync(item);
return CreatedAtRoute("Tables", new { id = current.Id }, current);
}
public Task DeleteTodoItem(string id)
{
return DeleteAsync(id);
}
}
}