Ejemplo n.º 1
0
        public ActionResult Delete(string adi)
        {

            if(adi!= null && adi!= " ")
            {
                dbDeneme = dbContext.egitimTablosuContext.Find(adi);
                dbContext.egitimTablosuContext.Remove(dbDeneme);
                dbContext.SaveChanges();

            }

            var modelim = new Models.database
            {
                egitimTablosuE = dbContext.egitimTablosuContext.ToList()
            };
            
            return View(modelim);
        }
Ejemplo n.º 2
0
        public ActionResult Update(string id,string adi,string soyadi)
        {
            SqlConnection con = new SqlConnection(con_string());
            con.Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = con;

            if(id!=null && id!=" " && adi!=null && adi!=" " && soyadi!= null && soyadi!=" ")
            {

              

                string query = "update deneme set adi='"+adi+"', soyadi='"+soyadi+"' where adi='"+id+"'";
                cmd.CommandText = query;
                cmd.ExecuteNonQuery();
                con.Close();
                return RedirectToAction("Delete");
            }

            if(id!=null && id!= " ")
            {
                var modelim = new Models.database
                {
                    egitimTablosu = dbContext.egitimTablosuContext.Find(id)
                };

                return View(modelim);

            }

            return RedirectToAction("Delete");
        }