Ejemplo n.º 1
0
        public object Get(LearningItem todo)
        {
            //return repo.GetAll ();
            //Return a single Todo if the id is provided.
            if (todo.Id != default(long))
                return Redis.As<LearningItem>().GetById(todo.Id);

            //Return all Todos items.
            return Redis.As<LearningItem>().GetAll();
        }
Ejemplo n.º 2
0
        public object Post(LearningItem item)
        {
            Console.WriteLine (item.ToJson());
            Console.WriteLine (item.ToString());

            //return null;
            var redis = Redis.As<LearningItem>();

            //Get next id for new todo
            if (item.Id == default(long))
                item.Id = redis.GetNextSequence();

            redis.Store(item);

            return new HttpResult(item)
            {
                Headers = {
                    { "Access-Control-Allow-Origin", "*" },
                    { "Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS" },
                    { "Access-Control-Allow-Headers", "Content-Type" }, }
            };
        }
 public void Create(LearningItem item)
 {
     throw new NotImplementedException ();
 }