public IActionResult DeleteCats(int catID) { Cat deteleCat = _catRepository.DeleteCat(catID); if (deteleCat != null) { TempData["message"] = $"Delete {deteleCat.Name}."; } return(RedirectToAction("CatsList")); }
public void Delete_Cat() { var cat = new Cat { Name = "Test Cat", Description = "Test Cat", Photo = "Test-Cat.jpg" }; _catRepository.CreateCat(cat); var resultId = _catRepository.GetCats().OrderByDescending(c => c.Id).Select(c => c.Id).FirstOrDefault(); _catRepository.DeleteCat(resultId); }
public async Task Delete_Cat() { var cat = new Cat { Name = "Test Cat", Description = "Test Cat", Photo = "Test-Cat.jpg" }; await _catRepository.CreateCat(cat); var result = await _catRepository.GetCats(); var id = result.OrderByDescending(c => c.Id).Select(c => c.Id).FirstOrDefault(); await _catRepository.DeleteCat(id); }
public void DeleteCat(int id) { _catRepository.DeleteCat(id); }
public async Task DeleteCat(int id) { await _catRepository.DeleteCat(id); }