public ActionResult DeleteConfirmed(int id)
        {
            tblDisease tblDisease = db.tblDiseases.Find(id);

            db.tblDiseases.Remove(tblDisease);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "DiseaseID,DiseaseName")] tblDisease tblDisease)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblDisease).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblDisease));
 }
        public ActionResult Create([Bind(Include = "DiseaseID,DiseaseName")] tblDisease tblDisease)
        {
            if (ModelState.IsValid)
            {
                db.tblDiseases.Add(tblDisease);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblDisease));
        }
        // GET: tblDiseases/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblDisease tblDisease = db.tblDiseases.Find(id);

            if (tblDisease == null)
            {
                return(HttpNotFound());
            }
            return(View(tblDisease));
        }
Beispiel #5
0
 private void BtnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         var db = new SQLiteConnection(dpPath);
         db.CreateTable <tblDisease>();
         tblDisease tbl = new tblDisease();
         tbl.disease     = txtDisease.Text;
         tbl.description = txtDescription.Text;
         tbl.cause       = txtCauses.Text;
         tbl.cure        = txtCure.Text;
         db.Insert(tbl);
         Toast.MakeText(this, "Record Added Successfully...,", ToastLength.Short).Show();
     }
     catch (Exception i)
     {
         Toast.MakeText(this, i.ToString(), ToastLength.Short).Show();
     }
 }