コード例 #1
0
        public void DeleteFails()
        {
            dbFactory.Run(db => db.Insert(new Category { Id = 1, Name = "Test Item" }));

            var repository = new CategoryRepository(dbFactory, personRepository);

            repository.Delete(2);
            dbFactory.Run(db =>
                              {
                                  var response = db.Select<Category>();

                                  Assert.AreEqual(response.Count, 1);
                                  Assert.AreEqual(response[0].Name, "Test Item");
                              });
        }
コード例 #2
0
        public void CategoryRepository_Delete()
        {
            var repository = new CategoryRepository(_categoryDataAccessMock);

            var category = new Category
            {
                Name = "Ausgang"
            };

            repository.Save(category);
            Assert.AreSame(category, _categoryDataAccessMock.CategoryTestList[0]);

            repository.Delete(category);

            Assert.IsFalse(_categoryDataAccessMock.CategoryTestList.Any());
            Assert.IsFalse(repository.Data.Any());
        }
コード例 #3
0
        public void CategoryRepository_Delete()
        {
            var categoryDataAccessMock = new CategoryDataAccessMock();
            var repository = new CategoryRepository(categoryDataAccessMock);

            var category = new Category
            {
                Name = "Ausgang"
            };

            repository.Save(category);

            categoryDataAccessMock.CategoryTestList[0].ShouldBeSameAs(category);

            repository.Delete(category);

            categoryDataAccessMock.CategoryTestList.Any().ShouldBeFalse();
            repository.Data.Any().ShouldBeFalse();
        }
コード例 #4
0
 public ActionResult Delete(int id)
 {
     categoryRepo.Delete(id);
     return(View("ShowAllList", categoryRepo.GetAll()));
 }
コード例 #5
0
        public ActionResult DeleteCategory(int id)
        {
            var rep = new CategoryRepository();
            rep.Delete(id);

            return RedirectToAction("Group");
        }
コード例 #6
0
 public bool Delete(int categoryId)
 {
     return(_categoryRepository.Delete(_categoryRepository.GetById(categoryId)));
 }
コード例 #7
0
        public void Delete(int ID)
        {
            ICategoryRepository ObjCatg = new CategoryRepository();

            ObjCatg.Delete(ID);
        }
コード例 #8
0
 public void DeleteSelectedCategory(Category item)
 {
     categoryRepository.Delete(item);
 }
コード例 #9
0
ファイル: CategoryBusiness.cs プロジェクト: dejidav/Ecommerce
 public void Delete(long?id)
 {
     _categoryRepository.Delete(id);
 }
コード例 #10
0
        public void DeleteCategoryTest()
        {
            var result = _repository.Delete(_entity);

            Assert.IsTrue(result);
        }
コード例 #11
0
 public ActionResult Confirm(int id)
 {
     categoryRepository.Delete(id);
     return(RedirectToAction("Index"));
 }
コード例 #12
0
        public Category Delete([FromBody] Category category)
        {
            _repository.Delete(category);

            return(category);
        }
コード例 #13
0
ファイル: SqlRepository.cs プロジェクト: mudcitizen/FSWeb
 public void DeleteCategory(CategoryUI entity)
 {
     CategoryRepository.Delete(mapper.Map <Category>(entity));
 }
コード例 #14
0
 public Response Delete(int CategoryId)
 {
     return(repo.Delete(CategoryId));
 }
コード例 #15
0
        public Category Delete([FromBody] Category category)
        {
            _context.Delete(category);

            return(category);
        }
コード例 #16
0
 public void Delete(int categoryId)
 {
     _categoryRepository.Delete(categoryId);
 }
コード例 #17
0
 public int Delete(int id)
 {
     return(db.Delete(id));
 }
コード例 #18
0
 public ActionResult DeleteCategory(int id)
 {
     cRep.Delete(cRep.Find(id));
     return(RedirectToAction("CategoryList"));
 }
コード例 #19
0
ファイル: Category.cs プロジェクト: h2002d/Warehouse
 public void Delete()
 {
     mCategoryRepository.Delete(this);
 }
コード例 #20
0
 public bool Delete(int id)
 {
     return(_categoryRepository.Delete(id));
 }
 public IHttpActionResult Delete(int id)
 {
     categoryrepository.Delete(id);
     return(StatusCode(HttpStatusCode.NoContent));
 }
コード例 #22
0
        public bool Delete(Category category)
        {
            bool isDeleted = _categoryRepository.Delete(category);

            return(isDeleted);
        }
コード例 #23
0
 public IHttpActionResult Delete(int id)
 {
     catRepo.Delete(id);
     return(StatusCode(HttpStatusCode.NoContent));
 }
コード例 #24
0
 public ActionResult Delete(Guid id)
 {
     result.resultint      = cr.Delete(id);
     TempData["Operation"] = result.resultint.IsSucceeded;
     return(RedirectToAction("List", new { @mesaj = result.resultint.UserMassage }));
 }
コード例 #25
0
 public ActionResult Delete(Guid id)
 {
     katRepo.Delete(id);
     return(RedirectToAction("Index", "Category", new { area = "Admin" }));
 }
コード例 #26
0
        public IHttpActionResult Delete(int id)
        {
            int result = categoryRepository.Delete(id);

            return(Ok());
        }
コード例 #27
0
 public ActionResult DeleteCategory(int id)
 {
     repository.Delete(repository.Get(id));
     return(RedirectToAction("/"));
 }
コード例 #28
0
        public async Task <Category> Delete([FromBody] Category category)
        {
            await _repositoryCategories.Delete(category);

            return(category);
        }
コード例 #29
0
 public ActionResult Delete(Category category)
 {
     _repo.Delete(category.CategoryID);
     TempData[TempDataMessageKey] = "Category Deleted!";
     return(RedirectToAction("Index"));
 }
コード例 #30
0
 public void Delete(Category category)
 {
     _categoryRepository.Delete(category);
 }
コード例 #31
0
 public ActionResult DeleteCategory(int id)
 {
     cat_repo.Delete(cat_repo.GetByID(id));
     return(RedirectToAction("ListCategory"));
 }
コード例 #32
0
        public bool Delete(int id)
        {
            bool isDeleted = categoryRepository.Delete(id);

            return(isDeleted);
        }
コード例 #33
0
 public void Delete(int id)
 {
     _categoryRepository.Delete(id);
 }
コード例 #34
0
 public bool Delete(Category category)
 {
     return(_categoryRepository.Delete(category));
 }
コード例 #35
0
        /// <summary>
        /// Delete all objects from database that match a specified resource category.
        /// </summary>
        /// <param name="resourceCategory">The resource category to remove all objects from.</param>
        /// <param name="resourceType">The type of resource to look for.</param>
        /// <param name="connectionString">If you need to connect to a specific database, use this to pass the connection string. Otherwise, the default connection string will be used (WinterConnectionInformation.ActiveConnectionString)</param>
        public void DeleteFromDatabaseByCategory(Category resourceCategory, GameObjectTypeEnum resourceType, string connectionString = "")
        {
            if (resourceType == GameObjectTypeEnum.Area)
            {
                using (AreaRepository repo = new AreaRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Conversation)
            {
                using (ConversationRepository repo = new ConversationRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Creature)
            {
                using (CreatureRepository repo = new CreatureRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Item)
            {
                using (ItemRepository repo = new ItemRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Placeable)
            {
                using (PlaceableRepository repo = new PlaceableRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Script)
            {
                using (ScriptRepository repo = new ScriptRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else if (resourceType == GameObjectTypeEnum.Tileset)
            {
                using (TilesetRepository repo = new TilesetRepository(connectionString))
                {
                    repo.DeleteAllByCategory(resourceCategory);
                }
            }
            else
            {
                throw new NotSupportedException();
            }

            // Now remove the category itself.
            using (CategoryRepository repo = new CategoryRepository())
            {
                Category dbCategory = repo.GetByID(resourceCategory.ResourceID);
                repo.Delete(dbCategory);
            }
        }
コード例 #36
0
 public ActionResult Delete(Guid id)
 {
     IRepository<Category> repo = new CategoryRepository();
     repo.Delete(repo.GetById(id));
     return RedirectToAction("Index");
 }