Esempio n. 1
0
        public ActionResult Current_Issu_Del2(int bid)
        {
            tblCurrentIssue ob = db.tblCurrentIssues.Find(bid);

            db.tblCurrentIssues.Remove(ob);
            db.SaveChanges();

            var current = db.tblCurrentIssues.OrderByDescending(x => x.CURENTISSUE_DATE).ToList();

            return(View("Current_Issu_Del", current));
        }
Esempio n. 2
0
        public ActionResult Current_Issue(tblCurrentIssue ob, HttpPostedFileBase file)
        {
            var query    = db.tblGroups.ToList();
            var dropdown = new SelectList(query, "GROUP_ID", "GROUP_ID");

            ViewBag.GroupVd = dropdown;

            var role_query         = db.tblArchives.ToList();
            var dropdown_archiveVD = new SelectList(role_query, "ARCHIVE_DETAILS", "ARCHIVE_DETAILS");

            ViewBag.RoleVD = dropdown_archiveVD;
            try
            {
                // tblArchive ob = new tblArchive();
                if (ModelState.IsValid)
                {
                    if (file != null)
                    {
                        var fileName = Path.GetFileName(file.FileName);
                        var guid     = Guid.NewGuid().ToString();
                        var path     = Path.Combine(Server.MapPath("~/Upload_File"), guid + fileName);
                        file.SaveAs(path);
                        string   fl        = path.Substring(path.LastIndexOf("\\"));
                        string[] split     = fl.Split('\\');
                        string   newpath   = split[1];
                        string   imagepath = "~/Upload_File/" + newpath;
                        ob.CURENTISSUE_FILEPATH = imagepath;
                    }
                    HtmlDocument doc = new HtmlDocument();
                    doc.LoadHtml(ob.CURENTISSUE_ABSTRACT);

                    foreach (var item in doc.DocumentNode.SelectNodes("//body")) // "//div" is a xpath which means select div nodes that are anywhere in the html
                    {
                        ob.CURENTISSUE_ABSTRACT = item.InnerHtml;                //your div content
                    }
                    db.tblCurrentIssues.Add(ob);
                    db.SaveChanges();
                    ViewBag.sucess = "success";
                    ModelState.Clear();
                }
            }
            catch
            {
            }
            return(View());
        }