Robofork15DemoService.cs
2.32 KB
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
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections.Generic;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.DocumentModel;
using Amazon.DynamoDBv2.Model;
using RoboforkApp.AWS.DynamoDb;
using RoboforkApp.Entities;
namespace RoboforkApp.Services
{
public class Robofork15DemoService
{
private readonly DynamoService _dynamoService;
public Robofork15DemoService()
{
_dynamoService = new DynamoService();
}
/// <summary>
/// AddRobofork15Demo will accept a Robofork15Demo object and creates an Item on Amazon DynamoDB
/// </summary>
/// <param name="robofork15Demo"></param>
public void AddRobofork15Demo(Robofork15Demo robofork15Demo)
{
_dynamoService.Store(robofork15Demo);
}
/// <summary>
/// ModifyRobofork15Demo tries to load an existing Robofork15Demo, modifies and saves it back. If the Item doesn’t exist, it raises an exception
/// </summary>
/// <param name="robofork15Demo"></param>
public void ModifyRobofork15Demo(Robofork15Demo robofork15Demo)
{
_dynamoService.UpdateItem(robofork15Demo);
}
/// <summary>
/// GetALllRobofork15Demos will perform a Table Scan operation to return all the Robofork15Demos
/// </summary>
/// <returns></returns>
public IEnumerable<Robofork15Demo> GetAllRobofork15Demos()
{
return _dynamoService.GetAll<Robofork15Demo>();
}
/// <summary>
/// SearchRobofork15Demos will search all data Robofork15Demos with id
/// </summary>
/// <param name="forkId">Fork Id</param>
/// <returns></returns>
public IEnumerable<Robofork15Demo> SearchRobofork15Demos(int forkId)
{
IEnumerable<Robofork15Demo> filteredRobofork15Demos = _dynamoService.DbContext.Query<Robofork15Demo>(forkId, QueryOperator.Equal);
return filteredRobofork15Demos;
}
/// <summary>
/// Delete Robofork15Demo will remove an item from DynamoDb
/// </summary>
/// <param name="robofork15Demo"></param>
public void DeleteRobofork15Demo(Robofork15Demo robofork15Demo)
{
_dynamoService.DeleteItem(robofork15Demo);
}
}
}