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"); }); }
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()); }
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(); }
public ActionResult Delete(int id) { categoryRepo.Delete(id); return(View("ShowAllList", categoryRepo.GetAll())); }
public ActionResult DeleteCategory(int id) { var rep = new CategoryRepository(); rep.Delete(id); return RedirectToAction("Group"); }
public bool Delete(int categoryId) { return(_categoryRepository.Delete(_categoryRepository.GetById(categoryId))); }
public void Delete(int ID) { ICategoryRepository ObjCatg = new CategoryRepository(); ObjCatg.Delete(ID); }
public void DeleteSelectedCategory(Category item) { categoryRepository.Delete(item); }
public void Delete(long?id) { _categoryRepository.Delete(id); }
public void DeleteCategoryTest() { var result = _repository.Delete(_entity); Assert.IsTrue(result); }
public ActionResult Confirm(int id) { categoryRepository.Delete(id); return(RedirectToAction("Index")); }
public Category Delete([FromBody] Category category) { _repository.Delete(category); return(category); }
public void DeleteCategory(CategoryUI entity) { CategoryRepository.Delete(mapper.Map <Category>(entity)); }
public Response Delete(int CategoryId) { return(repo.Delete(CategoryId)); }
public Category Delete([FromBody] Category category) { _context.Delete(category); return(category); }
public void Delete(int categoryId) { _categoryRepository.Delete(categoryId); }
public int Delete(int id) { return(db.Delete(id)); }
public ActionResult DeleteCategory(int id) { cRep.Delete(cRep.Find(id)); return(RedirectToAction("CategoryList")); }
public void Delete() { mCategoryRepository.Delete(this); }
public bool Delete(int id) { return(_categoryRepository.Delete(id)); }
public IHttpActionResult Delete(int id) { categoryrepository.Delete(id); return(StatusCode(HttpStatusCode.NoContent)); }
public bool Delete(Category category) { bool isDeleted = _categoryRepository.Delete(category); return(isDeleted); }
public IHttpActionResult Delete(int id) { catRepo.Delete(id); return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Delete(Guid id) { result.resultint = cr.Delete(id); TempData["Operation"] = result.resultint.IsSucceeded; return(RedirectToAction("List", new { @mesaj = result.resultint.UserMassage })); }
public ActionResult Delete(Guid id) { katRepo.Delete(id); return(RedirectToAction("Index", "Category", new { area = "Admin" })); }
public IHttpActionResult Delete(int id) { int result = categoryRepository.Delete(id); return(Ok()); }
public ActionResult DeleteCategory(int id) { repository.Delete(repository.Get(id)); return(RedirectToAction("/")); }
public async Task <Category> Delete([FromBody] Category category) { await _repositoryCategories.Delete(category); return(category); }
public ActionResult Delete(Category category) { _repo.Delete(category.CategoryID); TempData[TempDataMessageKey] = "Category Deleted!"; return(RedirectToAction("Index")); }
public void Delete(Category category) { _categoryRepository.Delete(category); }
public ActionResult DeleteCategory(int id) { cat_repo.Delete(cat_repo.GetByID(id)); return(RedirectToAction("ListCategory")); }
public bool Delete(int id) { bool isDeleted = categoryRepository.Delete(id); return(isDeleted); }
public void Delete(int id) { _categoryRepository.Delete(id); }
public bool Delete(Category category) { return(_categoryRepository.Delete(category)); }
/// <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); } }
public ActionResult Delete(Guid id) { IRepository<Category> repo = new CategoryRepository(); repo.Delete(repo.GetById(id)); return RedirectToAction("Index"); }