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();
}
///
/// AddRobofork15Demo will accept a Robofork15Demo object and creates an Item on Amazon DynamoDB
///
///
public void AddRobofork15Demo(Robofork15Demo robofork15Demo)
{
_dynamoService.Store(robofork15Demo);
}
///
/// ModifyRobofork15Demo tries to load an existing Robofork15Demo, modifies and saves it back. If the Item doesn’t exist, it raises an exception
///
///
public void ModifyRobofork15Demo(Robofork15Demo robofork15Demo)
{
_dynamoService.UpdateItem(robofork15Demo);
}
///
/// GetALllRobofork15Demos will perform a Table Scan operation to return all the Robofork15Demos
///
///
public IEnumerable GetAllRobofork15Demos()
{
return _dynamoService.GetAll();
}
///
/// SearchRobofork15Demos will search all data Robofork15Demos with id
///
/// Fork Id
///
public IEnumerable SearchRobofork15Demos(int forkId)
{
IEnumerable filteredRobofork15Demos = _dynamoService.DbContext.Query(forkId, QueryOperator.Equal);
return filteredRobofork15Demos;
}
///
/// Delete Robofork15Demo will remove an item from DynamoDb
///
///
public void DeleteRobofork15Demo(Robofork15Demo robofork15Demo)
{
_dynamoService.DeleteItem(robofork15Demo);
}
}
}