protected void btnSaveSubTest_Click(object sender, EventArgs e)
        {
            SubTests sTests = new SubTests();

            if (!string.IsNullOrEmpty(ddTestId.SelectedValue) || !string.IsNullOrEmpty(txtSubtest.Text) || !string.IsNullOrEmpty(txtPrice.Text))
            {
                sTests.test_id       = Convert.ToInt32(ddTestId.SelectedValue);
                sTests.Sub_test_name = txtSubtest.Text;
                sTests.test_price    = Convert.ToInt32(txtPrice.Text);
                int rowCount = _ltManager.Save(sTests);
                if (rowCount > 0)
                {
                    warningPanel.Visible = false;
                    successPanel.Visible = true;
                    alertText.InnerHtml  = "Saved Successfully";
                }
                else
                {
                    successPanel.Visible = false;
                    warningPanel.Visible = true;
                    errorName.InnerHtml  = "Warning";
                    errorText.InnerHtml  = "Field Canot Be empty";
                }
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            SubTests subTests = db.SubTests.Find(id);

            db.SubTests.Remove(subTests);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,SubTestId,SubTestName")] SubTests subTests)
 {
     if (ModelState.IsValid)
     {
         db.Entry(subTests).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(subTests));
 }
        public ActionResult Create([Bind(Include = "ID,SubTestId,SubTestName")] SubTests subTests)
        {
            if (ModelState.IsValid)
            {
                db.SubTests.Add(subTests);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(subTests));
        }
 internal int Save(SubTests sTests)
 {
     connection.Open();
     command = new SqlCommand("sp_subLabTest", connection);
     command.Parameters.Clear();
     command.Parameters.Add("@test_id", SqlDbType.Int).Value            = sTests.test_id;
     command.Parameters.Add("@sub_test_name", SqlDbType.NVarChar).Value = sTests.Sub_test_name;
     command.Parameters.Add("@test_price", SqlDbType.Int).Value         = sTests.test_price;
     command.CommandType = CommandType.StoredProcedure;
     row = command.ExecuteNonQuery();
     connection.Close();
     return(row);
 }
        // GET: SubTests/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SubTests subTests = db.SubTests.Find(id);

            if (subTests == null)
            {
                return(HttpNotFound());
            }
            return(View(subTests));
        }
 internal int Save(SubTests sTests)
 {
     return(_ltgateway.Save(sTests));
 }