//POST: Delete Album public ActionResult Delete(int id) { if (ModelState.IsValid) { try { var isAlbumDeleted = _albumManager.DeleteAlbum(id); if (isAlbumDeleted) { TempData[Alert.AlertMsgKey] = "Album Deleted Successfully..."; TempData[Alert.AlertTypeKey] = Alert.AlertSuccess; } } catch (Exception e) { //write error to log file Console.WriteLine($"{e.Message} ---> {e.Source}"); //display error msg to user TempData[Alert.AlertMsgKey] = "Sorry, Failed to delete album..."; TempData[Alert.AlertTypeKey] = Alert.AlertDanger; } } return(RedirectToAction("Index", "Home", new { alert = true })); }