示例#1
0
 public bool Remove(Guid todoId)
 {
     if (_inMemoryTodoDatabase.Count == 0 || this.Get(todoId) == null)
     {
         return(false);
     }
     return(_inMemoryTodoDatabase.Remove(_inMemoryTodoDatabase.First(t => t.Id == todoId)));
 }
示例#2
0
 public bool Remove(Guid todoId)
 {
     if (_inMemoryTodoDatabase.Any(s => s.Id == todoId))
     {
         var found = _inMemoryTodoDatabase.First(s => s.Id == todoId);
         _inMemoryTodoDatabase.Remove(found);
         return(true);
     }
     return(false);
 }
        public bool Remove(Guid todoId)
        {
            TodoItem i = Get(todoId);

            if (i == null)
            {
                return(false);
            }
            return(_inMemoryTodoDatabase.Remove(i));;
        }
示例#4
0
        public bool Remove(Guid todoId)
        {
            var item = Get(todoId);

            if (item == null)
            {
                return(false);
            }

            _inMemoryTodoDatabase.Remove(item);
            return(true);
        }
示例#5
0
        public bool Remove(Guid todoId)
        {
            if (_inMemoryTodoDatabase.FirstOrDefault(i => i.Id.Equals(todoId)) != null)
            {
                TodoItem item = _inMemoryTodoDatabase.FirstOrDefault(i => i.Id.Equals(todoId));

                _inMemoryTodoDatabase.Remove(item);

                return(true);
            }

            return(false);
        }
示例#6
0
        public bool Remove(Guid todoId)
        {
            TodoItem todoItem = (TodoItem)_inMemoryTodoDatabase.FirstOrDefault(i => i.Id == todoId);

            if (todoItem == null)
            {
                return(false);
            }
            else
            {
                _inMemoryTodoDatabase.Remove(todoItem);
                return(true);
            }
        }
示例#7
0
 public static void ListExampleGenerics(IGenericList <string> listOfGenerics)
 {
     listOfGenerics.Add("a");                                     // [a]
     listOfGenerics.Add("b");                                     // [a,b]
     listOfGenerics.Add("car");                                   // [a,b,car]
     listOfGenerics.Add("house");                                 // [a,b,car,house]
     listOfGenerics.Add("roof");                                  // [a,b,car,house,roof]
     listOfGenerics.RemoveAt(0);                                  // [b,car,house,roof]
     listOfGenerics.Remove("house");                              //[b,car,house]
     Console.WriteLine(listOfGenerics.Count);                     // 3
     Console.WriteLine(listOfGenerics.Remove("nonExistingWord")); // false
     Console.WriteLine(listOfGenerics.RemoveAt(5));               // false
     listOfGenerics.Clear();                                      // []
     Console.WriteLine(listOfGenerics.Count);                     // 0
 }
示例#8
0
 public static void ListExample(IGenericList <int> listOfIntegers)
 {
     listOfIntegers.Add(1);                         // [1]
     listOfIntegers.Add(2);                         // [1 ,2]
     listOfIntegers.Add(3);                         // [1 ,2 ,3]
     listOfIntegers.Add(4);                         // [1 ,2 ,3 ,4]
     listOfIntegers.Add(5);                         // [1 ,2 ,3 ,4 ,5]
     listOfIntegers.RemoveAt(0);                    // [2 ,3 ,4 ,5]
     listOfIntegers.Remove(5);                      //[2 ,3 ,4]
     Console.WriteLine(listOfIntegers.Count);       // 3
     Console.WriteLine(listOfIntegers.Remove(100)); // false
     Console.WriteLine(listOfIntegers.RemoveAt(5)); // false
     listOfIntegers.Clear();                        // []
     Console.WriteLine(listOfIntegers.Count);       // 0
 }
示例#9
0
 public static void ListExample(IGenericList <string> list)
 {
     list.Add("1a");
     list.Add("2b");
     list.Add("3c");
     list.Add("4d");
     list.Add("5e");
     list.RemoveAt(0);
     list.Remove("5e");
     WriteLine(list.GetElement(2));
     WriteLine(list.Count);
     WriteLine(list.Remove("100"));
     WriteLine(list.RemoveAt(5));
     list.Clear();
     WriteLine(list.Count);
 }
示例#10
0
 public static void ListOfExamples(IGenericList <double> listOfIntegers)
 {
     listOfIntegers.Add(1.3);                       // [1]
     listOfIntegers.Add(2.2);                       // [1 ,2]
     listOfIntegers.Add(3.4);                       // [1 ,2 ,3]
     listOfIntegers.Add(4.5);                       // [1 ,2 ,3 ,4]
     listOfIntegers.Add(5.2);                       // [1 ,2 ,3 ,4 ,5]
     listOfIntegers.RemoveAt(0);                    // [2 ,3 ,4 ,5]
     listOfIntegers.Remove(5.2);
     Console.WriteLine(listOfIntegers.Count);       // 3
     Console.WriteLine(listOfIntegers.Remove(100)); // false
     Console.WriteLine(listOfIntegers.RemoveAt(5)); // false
     listOfIntegers.Clear();                        // []
     Console.WriteLine(listOfIntegers.Count);       // 0
     Console.ReadLine();
 }
示例#11
0
        public bool Remove(Guid todoId)
        {
            var found = _inMemoryTodoDatabase.Where(s => s.Id == todoId).First();

            _inMemoryTodoDatabase.Remove(found);
            return(true);
        }
示例#12
0
 public bool Remove(Guid todoId)
 {
     if (Get(todoId) != null)
     {
         return(_inMemoryTodoDatabase.Remove(Get(todoId)));
     }
     return(false);
 }
示例#13
0
 public bool Remove(Guid todoId)
 {
     if (_inMemoryTodoDatabase.Any(t => t.Id.Equals(todoId)))
     {
         var itemToRemove = _inMemoryTodoDatabase.First(t => t.Id.Equals(todoId));
         return(_inMemoryTodoDatabase.Remove(itemToRemove));
     }
     return(false);
 }
示例#14
0
 /// <summary >
 /// Tries to remove a TodoItem with given id from the database .
 /// </ summary >
 /// <returns > True if success , false otherwise </ returns >
 public bool Remove(Guid todoId)
 {
     if (Get(todoId) != null)
     {
         _inMemoryTodoDatabase.Remove(this.Get(todoId));
         return(true);
     }
     return(false);
 }
示例#15
0
        public bool Remove(Guid todoId)
        {
            TodoItem item = Get(todoId);

            if (object.ReferenceEquals(item, null))
            {
                return(false);
            }
            return(_inMemoryTodoDatabase.Remove(item));
        }
示例#16
0
        public bool Remove(Guid todoId)
        {
            var rez = _inMemoryTodoDatabase.Where(i => i.Id == todoId).ToArray();

            if (rez.Length == 0)
            {
                return(false);
            }
            return(_inMemoryTodoDatabase.Remove(rez[0]));
        }
示例#17
0
        public bool MarkAsCompleted(Guid todoId)
        {
            /// <summary >
            /// Tries to mark a TodoItem as completed in the database .
            /// </ summary >
            /// <returns > True if success , false otherwise </ returns >
            ///TodoItem temp = null;
            TodoItem temp = _inMemoryTodoDatabase.Where(o => o.Id.Equals(todoId)).FirstOrDefault();

            if (temp != null)
            {
                _inMemoryTodoDatabase.Remove(temp);
                temp.MarkAsCompleted();
                _inMemoryTodoDatabase.Add(temp);
                return(true);
            }
            return(false);
            //throw new NotImplementedException();
        }
示例#18
0
 public bool Remove(Guid todoId)
 {
     if (Get(todoId) != null)
     {
         TodoItem removeItem = Get(todoId);
         _inMemoryTodoDateBase.Remove(removeItem);
         return(true);
     }
     return(false);
 }
示例#19
0
        public bool Remove(Guid todoId)
        {
            IEnumerable <TodoItem> temp = _inMemoryTodoDatabase.Where(i => i.Id == todoId);

            if (temp.Any())
            {
                return(_inMemoryTodoDatabase.Remove(temp.FirstOrDefault()));
            }

            return(false);
        }
示例#20
0
        public bool Remove(Guid todoId)
        {
            IEnumerable <TodoItem> todoItems = _inMemoryTodoDatabase.Where(item => item.Id == todoId);
            TodoItem todoItem = todoItems.FirstOrDefault();

            if (todoItem == null)
            {
                return(false);
            }
            return(_inMemoryTodoDatabase.Remove(todoItem));
        }
示例#21
0
        public bool Remove(Guid todoId)
        {
            TodoItem item = _inMemoryTodoDatabase.Where(s => s.Id.Equals(todoId)).FirstOrDefault();

            if (item == null)
            {
                return(false);
            }
            _inMemoryTodoDatabase.Remove(item);
            return(true);
        }
示例#22
0
        public bool Remove(Guid todoId)
        {
            TodoItem t = Get(todoId);

            if (t != null)
            {
                _inMemoryTodoDatabase.Remove(t);
                return(true);
            }

            return(false);
        }
示例#23
0
        public bool Remove(Guid todoId)
        {
            TodoItem remove = Get(todoId);

            if (remove != null)
            {
                return(_inMemoryTodoDatabase.Remove(remove));
            }
            else
            {
                return(false);
            }
        }
示例#24
0
        public bool Remove(Guid todoId)
        {
            TodoItem item = this.Get(todoId);

            if (item == null)
            {
                return(false);
            }
            else
            {
                return(_inMemoryTodoDatabase.Remove(item));
            }
        }
示例#25
0
        /// <summary>
        /// Removes item which has given Guid
        /// </summary>
        /// <param name="todoId">Given Guid</param>
        /// <returns>True if the operation was success, false if it was not.</returns>
        public bool Remove(Guid todoId)
        {
            var itemToBeRemoved = Get(todoId);

            if (itemToBeRemoved == null)
            {
                return(false);
            }
            else
            {
                _inMemoryToDoDatabase.Remove(itemToBeRemoved);
                return(true);
            }
        }
示例#26
0
        public bool Remove(Guid todoId)
        {
            TodoItem todoItem = _inMemoryTodoDatabase.FirstOrDefault(p => p.Id.Equals(todoId));

            if (todoItem == null)
            {
                return(false);
            }
            else
            {
                _inMemoryTodoDatabase.Remove(todoItem);
                return(true);
            }
        }
示例#27
0
        public bool Remove(Guid guid)
        {
            TodoItem item = _inMemoryTodoDatabase.Where(i => i.Id == guid).FirstOrDefault();

            if (item == null)
            {
                return(false);
            }
            else
            {
                _inMemoryTodoDatabase.Remove(item);
                return(true);
            }
        }
示例#28
0
        public bool Remove(Guid todoId)
        {
            if (todoId == Guid.Empty || todoId == null)
            {
                throw new ArgumentException();
            }
            IEnumerable <TodoItem> pronadi_element =
                from item in _inMemoryTodoDatabase
                where item.Id == todoId
                select item;

            if (pronadi_element.Count() > 0)
            {
                return(_inMemoryTodoDatabase.Remove(pronadi_element.First()));
            }
            return(false);
        }
示例#29
0
        public bool Remove(Guid todoId)
        {
            if (_inMemoryTodoDatabase.Count() == 0)
            {
                return(false);
            }
            TodoItem t = _inMemoryTodoDatabase.FirstOrDefault(i =>
            {
                if (i == null)
                {
                    return(false);
                }
                return(i.Id == todoId);
            });

            if (t == null)
            {
                return(false);
            }
            _inMemoryTodoDatabase.Remove(t);
            return(true);
        }
示例#30
0
 public bool Remove(Guid todoId)
 {
     return(_inMemoryTodoDatabase.Remove(Get(todoId)));
 }