コード例 #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);
 }
コード例 #3
0
        public bool Remove(Guid todoId)
        {
            TodoItem i = Get(todoId);

            if (i == null)
            {
                return(false);
            }
            return(_inMemoryTodoDatabase.Remove(i));;
        }
コード例 #4
0
ファイル: TodoRepository.cs プロジェクト: mgulan13/raupjc-hw2
        public bool Remove(Guid todoId)
        {
            var item = Get(todoId);

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

            _inMemoryTodoDatabase.Remove(item);
            return(true);
        }
コード例 #5
0
ファイル: TodoRepository.cs プロジェクト: fgolubic/raupjc-hw2
        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
ファイル: Program.cs プロジェクト: drlukas6/raupjc-hw1
 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
ファイル: Program.cs プロジェクト: fgolubic/raupjc-hw1
 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
ファイル: TodoRepository.cs プロジェクト: ivonamr/raupjc-hw2
        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
ファイル: TodoRepository.cs プロジェクト: Solver34/rajupc-hw2
        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
ファイル: Class1.cs プロジェクト: miaoreskovic/raupjc-hw2
        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
ファイル: Class1.cs プロジェクト: kv70416/raupjc-hw2
        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
ファイル: ITodoRepository.cs プロジェクト: miatom/2_DZ
        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)));
 }