public IActionResult Delete(int id) { Label label = _context.Labels.FirstOrDefault(l => l.Id == id); if (label == null) { return(NotFound()); } _context.Remove(label); _context.SaveChanges(); return(RedirectToAction("index")); }
public IActionResult Delete(int id) { var slider = _context.SliderItems.FirstOrDefault(w => w.Id == id); _context.Remove(slider); if (slider.Image != null) { _fileManager.Delete(slider.Image); } _context.SaveChanges(); return(RedirectToAction("index")); }
public IActionResult Delete(int id) { var post = _context.Posts.FirstOrDefault(p => p.Id == id); _context.Remove(post); if (post.Image != null) { _fileManager.Delete(post.Image); } _context.SaveChanges(); return(RedirectToAction("index")); }