Beispiel #1
0
        public JsonResult DeleteAttach(String idAttach, String idDepto, String fileName)
        {
            AttachmentHelper ah = new AttachmentHelper();

            //delete references tblAttachmentstags
            int delR = ah.DeleteAttachRelation(int.Parse(idAttach), int.Parse(idDepto));
            //delete from tblAttachments
            int delA = ah.DeleteAttach(int.Parse(idAttach));
            //delete file from Path
            string _path = Path.Combine(Server.MapPath("~/UploadedFiles/attachments/"), fileName);

            System.IO.File.Delete(_path);

            if (delR == 1 && delA == 1)
            {
                return(Json("successfully"));
            }
            else
            {
                return(Json("Error"));
            }
        }