private void CheckTextBoxDelete(TextBox a) { if (String.IsNullOrEmpty(a.Text)) { MessageBox.Show("Invalid values entered. Check the input, please"); } else if (fileLogic.GetTitleForDelete(id1, a.Text) == 0) { MessageBox.Show("No such file exists. Check the input, please"); } else { fileLogic.DeleteFile("DeleteFile", TitleBox1.Text, dateTimePicker1.Value, id1); } }
public ActionResult DeleteFile(int ArticleID, string File) { try { FileModel fileModel = Flogic.GetCurrentFile(ArticleID, File); Flogic.DeleteFile(ArticleID, fileModel.File_ID); return(RedirectToAction("EditFile", "File")); } catch (SqlException sqlException) { return(View("Error", sqlException)); } catch (InvalidCastException invalidCastException) { return(View("Error", invalidCastException)); } }