public IActionResult ViewAdminDelete(IFormCollection collection) { using (var db = new parttimejobContext()) { //var id = System.Web.HttpUtility.UrlDecode(RId); //var id = Request.Form["RId"].ToString(); //var id = request["id"]; string id = collection["RId"]; var Res = db.Recruit.FirstOrDefault(b => b.RId == id); db.Remove(Res); db.SaveChanges(); var script = String.Format("<script>alert('Delete Successful!');location.href = '{0}'</script>", Url.Action("ViewAdmin")); return(Content(script, "text/html")); } }
/// <summary> /// 个人删除招聘信息 /// </summary> /// <param name="collection"></param> /// <returns></returns> public IActionResult PDelete(string RId) { using (var db = new parttimejobContext()) { //var id = System.Web.HttpUtility.UrlDecode(RId); //var id = Request.Form["RId"].ToString(); //var id = request["id"]; string id = System.Web.HttpUtility.UrlDecode(RId); List <Intention> intentions = db.Intention.ToList(); intentions = (from a in intentions where a.RId == id select a).ToList(); foreach (var i in intentions) { db.Intention.Remove(i); } var Res = db.Recruit.FirstOrDefault(b => b.RId == id); db.Remove(Res); db.SaveChanges(); var script = String.Format("<script>alert('success');location.href = '{0}'</script>", Url.Action("PRecruitList") + "?PId=" + System.Web.HttpUtility.UrlEncode(Res.PId)); return(Content(script, "text/html")); //return RedirectToAction("PRecruit"); } }
public IActionResult Companys(string flag, IFormCollection coll) { using (parttimejobContext db = new parttimejobContext()) { var x = db.Recruit.Where(b => b.CId == common.key).ToList(); ViewBag.a = x; string id = coll["RId"]; if (flag == "no") { var rinfo = db.Recruit.FirstOrDefault(b => b.RId == id); db.Remove(rinfo); db.SaveChanges(); var script = String.Format("<script>alert('Successfully!');location.href = '{0}'</script>", Url.Action("Companys")); return(Content(script, "text/html")); } else { } var cinfo = db.Companyinfo.FirstOrDefault(b => b.CId == common.key); if (cinfo == null) { ViewData["error"] = "提示:您还没有完善信息,请点击公司信息编辑完善"; return(View("Companys")); } else { ViewData["cname"] = cinfo.CName; ViewData["cindustry"] = cinfo.CIndustry; ViewData["caddress"] = cinfo.CAddress; ViewData["csize"] = cinfo.CSize; ViewData["cremark"] = cinfo.CRemark; ViewData["ctel"] = cinfo.CTel; return(View("Companys")); } } }
public IActionResult Persons(string flag, IFormCollection coll) { using (parttimejobContext db = new parttimejobContext()) { var x = db.Recruit.Where(b => b.PId == common.key).ToList(); ViewBag.a = x; string id = coll["RId"]; if (flag == "no") { var rinfo = db.Recruit.FirstOrDefault(b => b.RId == id); db.Remove(rinfo); db.SaveChanges(); var script = String.Format("<script>alert('Successfully!');location.href = '{0}'</script>", Url.Action("Persons")); return(Content(script, "text/html")); } else { } var cinfo = db.Personinfo.FirstOrDefault(b => b.PId == common.key); if (cinfo == null) { ViewData["error"] = "提示:您还没有完善信息,请点击个人信息编辑完善"; return(View()); } else { ViewData["pname"] = cinfo.PName; ViewData["psex"] = cinfo.PSex; ViewData["paddress"] = cinfo.PAddress; ViewData["pnumber"] = cinfo.PNumber; ViewData["premark"] = cinfo.CRemark; ViewData["ptel"] = cinfo.PTel; return(View()); } } }