Exemplo n.º 1
0
 // GET: Contact
 public ActionResult ContactForm()
 {
     postjob p = new postjob();
     List<postjob> Li = new List<postjob>();
     Li = p.JobDisplay();
     ViewData["JobDisplay"] = Li;
     //ViewBag.MyList = Li;
     return View();
 }
Exemplo n.º 2
0
        public ActionResult DeleteJob(postjob f)
        {
            D.Open();
            int i = D.DataDelete("DELETE FROM Job_table WHERE  Name= '" + f.Name + "'  ");
            D.Close();

            if (i > 0)
            {
                ModelState.AddModelError("Success", "Save Success");
            }
            else
            {
                ModelState.AddModelError("Error", "Save Error");
            }
            return RedirectToAction("Index", "Dashboard");
        }
Exemplo n.º 3
0
        public List<postjob> JobDisplay()
        {
            SqlConnection con = new SqlConnection(constr);
            con.Open();

            using (con)
            {
                SqlCommand cmd = new SqlCommand("Select * from Job_table ", con);
                SqlDataReader rd = cmd.ExecuteReader();

                while (rd.Read())
                {

                    p = new postjob();
                    p.Name = Convert.ToString(rd.GetSqlValue(1));
                    p.Req = Convert.ToString(rd.GetSqlValue(2));
                    p.Des = Convert.ToString(rd.GetSqlValue(3));
                    Jobs.Add(p);

                }
                return Jobs;
            }
        }
Exemplo n.º 4
0
        public ActionResult SaveJob(postjob f)
        {
            if (ModelState.IsValid)
            {

                D.Open();
                int i = D.DataInsert("INSERT INTO Job_table(Name,Req,Gen) VALUES ('" + f.Name + "','" + f.Req + "','" + f.Des + "')");
                if (i > 0)
                {
                    ModelState.AddModelError("Success", "Save Success");
                }
                else
                {
                    ModelState.AddModelError("Error", "Save Error");
                }

                D.Close();
            }

            return RedirectToAction("Index", "Dashboard");
        }
Exemplo n.º 5
0
 // GET: Dashboard
 public ActionResult Index()
 {
     postjob p = new postjob();
     List<postjob> Li = new List<postjob>();
     Li = p.JobDisplay();
     ViewData["JobDisplay"] = Li;
     return View();
 }