public ActionResult Second_Tab_Create(tab_second_type tab)
 {
     try
     {
         if (!string.IsNullOrEmpty(tab.second_type))
         {
             tab_second_type item = db.tab_second_type.Find(tab.second_type);
             if (item != null)
             {
                 return(new HttpStatusCodeResult(205, "ResetContent"));
             }
             db.tab_second_type.Add(tab);
             db.SaveChanges();
             return(new HttpStatusCodeResult(200, "Add Second Tab Success"));
         }
         else
         {
             return(new HttpStatusCodeResult(204, "No Content"));
         }
     }
     catch (Exception err)
     {
         return(new HttpStatusCodeResult(400, err.Message));
     }
 }
        // GET: Second Tab
        public JsonResult Second_Tab_Query_byRange(tab_second_type tab2)
        {
            string sql = "select * from tab_second_type where 1 ";

            if (!string.IsNullOrEmpty(tab2.first_type))
            {
                sql += string.Format(" and first_type='{0}'", tab2.first_type);
            }
            if (!string.IsNullOrEmpty(tab2.second_type))
            {
                sql += string.Format(" and second_type='{0}'", tab2.second_type);
            }
            if (!string.IsNullOrEmpty(tab2.description))
            {
                sql += string.Format(" and description='{0}'", tab2.description);
            }
            List <tab_second_type> items = db.tab_second_type.SqlQuery(sql).ToList();

            return(Json(items, JsonRequestBehavior.AllowGet));
        }
 // GET: Tab/Second_Tab_Delete
 public ActionResult Second_Tab_Delete(tab_second_type tab)
 {
     try
     {
         string sql = string.Format("select * from tab_second_type where first_type='{0}' and second_type='{1}'", tab.first_type, tab.second_type);
         List <tab_second_type> items = db.tab_second_type.SqlQuery(sql).ToList();
         if (items.Count > 0)
         {
             tab_second_type item = items[0];
             db.tab_second_type.Attach(item);
             db.tab_second_type.Remove(item);
             db.SaveChanges();
             return(new HttpStatusCodeResult(200, "Delete Tab Success"));
         }
         else
         {
             return(new HttpStatusCodeResult(204, "No Content"));
         }
     }
     catch (Exception err)
     {
         return(new HttpStatusCodeResult(400, err.Message));
     }
 }