Example #1
0
        public void Update(TodoModel updatedTodo)
        {
            var existingtodo = _cache[updatedTodo.Key];

            existingtodo.Priority = updatedTodo.Priority;
            existingtodo.Title    = updatedTodo.Title;
            existingtodo.Details  = updatedTodo.Details;
        }
Example #2
0
        public void Update(TodoModel updatedTodo)
        {
            var existingToDo = _cache[updatedTodo.Title];

            existingToDo.Priority = updatedTodo.Priority;
            existingToDo.Details  = updatedTodo.Details;
            _data.saveTodos(_cache.Select(t => t.Value));
        }
Example #3
0
        private TodoModel CreateTodo()
        {
            TodoModel model = new TodoModel();

            model.Title    = Title;
            model.Details  = Details;
            model.Priority = Priority ?? 1;

            return(model);
        }
Example #4
0
        private static TodoModel ParseValues(string[] values)
        {
            TodoModel model = new TodoModel();

            for (int i = 1; i < values.Length; i++)
            {
                var property = values[i].Split('=');
                switch (property[0].ToLower())
                {
                case "key":
                {
                    model.Key = int.Parse(property[1]);
                    break;
                }

                case "priority":
                {
                    model.Priority = int.Parse(property[1]);
                    break;
                }

                case "title":
                {
                    model.Title = property[1].Trim().Trim('"');
                    break;
                }

                case "details":
                {
                    model.Details = property[1].Trim().Trim('"');
                    break;
                }
                }
            }

            return(model);
        }
Example #5
0
        private void UpdateTodo()
        {
            TodoModel updatedModel = CreateTodo();

            _logic.Update(updatedModel);
        }
Example #6
0
        private void AddNewTodo()
        {
            TodoModel newModel = CreateTodo();

            _logic.Add(newModel);
        }
Example #7
0
        private void DeleteTodo()
        {
            TodoModel modelToDelete = CreateTodo();

            _logic.Delete(modelToDelete);
        }
Example #8
0
public void update(TodoModel updateTodo)
Example #9
0
     public void add(TodoModel newtodo)
{
        cache.add(newtodo.key,newtodo);
    }
Example #10
0
 public void Add(TodoModel newTodo)
 {
     _cache.Add(newTodo.Key, newTodo);
 }
Example #11
0
 public void Delete(TodoModel noLongerNeededTodo)
 {
     _cache.Remove(noLongerNeededTodo.Key);
 }
Example #12
0
        private static void DeleteTodo(string[] values)
        {
            TodoModel modelToDelete = ParseValues(values);

            _logic.Delete(modelToDelete);
        }
Example #13
0
        private static void UpdateTodo(string[] values)
        {
            TodoModel updatedModel = ParseValues(values);

            _logic.Update(updatedModel);
        }
Example #14
0
        private static void AddNewTodo(string[] values)
        {
            TodoModel newModel = ParseValues(values);

            _logic.Add(newModel);
        }
Example #15
0
 public void Delete(TodoModel noLongerNeededTodo)
 {
     _cache.Remove(noLongerNeededTodo.Title);
     _data.saveTodos(_cache.Select(t => t.Value));
 }
Example #16
0
 public void Add(TodoModel newTodo)
 {
     _cache.Add(newTodo.Title, newTodo);
     _data.saveTodos(_cache.Select(t => t.Value));
 }