public object Get(Todo todo)
        {
            //Return a single Todo if the id is provided.
            if (todo.Id != default(long))
                return Redis.As<Todo>().GetById(todo.Id);

            //Return all Todos items.
            return Redis.As<Todo>().GetAll();
        }
 /// <summary>
 /// Handles creating and updating the Todo items.
 /// </summary>
 /// <param name="todo">The todo.</param>
 /// <returns></returns>
 public Todo Post(Todo todo)
 {
     RedisManager.ExecAs<Todo>(r =>
     {
         //Get next id for new todo
         if (todo.Id == default(long)) todo.Id = r.GetNextSequence();
         r.Store(todo);
     });
     return todo;
 }
        public object Get(Todo todo)
        {
            //Return a single Todo if the id is provided.
            if (todo.Id != default(long))
            {
                return RedisManager.ExecAs<Todo>(r => r.GetById(todo.Id));
            }

            //Return all Todos items.
            return RedisManager.ExecAs<Todo>(r => r.GetAll());
        }
 /// <summary>
 /// Handles creating and updating the Todo items.
 /// </summary>
 public Todo Post(Todo todo)
 {
     var redis = Redis.As<Todo>();
     
     //Get next id for new todo
     if (todo.Id == default(long)) 
         todo.Id = redis.GetNextSequence();
     
     redis.Store(todo);
     
     return todo;
 }
 public object Delete(Todo todo)
 {
     RedisManager.ExecAs<Todo>(r => r.DeleteById(todo.Id));
     return null;
 }
 /// <summary>
 /// Handles creating and updating the Todo items.
 /// </summary>
 /// <param name="todo">The todo.</param>
 /// <returns></returns>
 public Todo Put(Todo todo)
 {
     return Post(todo);
 }
 /// <summary>
 /// Handles Deleting the Todo item
 /// </summary>
 public void Delete(Todo todo)
 {
     Redis.As<Todo>().DeleteById(todo.Id);
 }