public async Task <IActionResult> Delete(int id) { try { await _modelsRepository.Delete(id); return(NoContent()); } catch (InvalidModelException) { return(NotFound()); } }
public async Task <IActionResult> Delete(int id) { SahibindenBitirmeProjesi.Entity.Entities.Concrete.Models model = await _modelsRepository.GetById(id); if (model != null) { await _modelsRepository.Delete(model); TempData["Success"] = "Model başarıyla silindi..!"; return(RedirectToAction("List")); } else { TempData["Error"] = "Model silindi..!"; return(RedirectToAction("List")); } }