コード例 #1
0
        // GET: Db
        public ActionResult Index()
        {
            bool bStatus = DB.Open();

            if (bStatus)
            {
                return(Content(bStatus.ToString()));
            }
            else
            {
                return(Content(bStatus.ToString()));
            }
        }
コード例 #2
0
ファイル: StudentController.cs プロジェクト: Darshana94/MVC
 public ActionResult SaveDataStudent(StudentModel f)
 {
     if (ModelState.IsValid)
     {
         D.Open();
         int i = D.DataInsert("INSERT INTO tblproduct(productname,quantity,price)VALUES('" + f.productname + "','" + f.quantity + "','" + f.price + "',)");
         if (i > 0)
         {
             ModelState.AddModelError("Success", "Save Success");
         }
         else
         {
             ModelState.AddModelError("Error", "Save Error");
         }
         D.Close();
     }
     return(RedirectToAction("Index", "Student"));
 }