public bool Delete(TB_TourRegionExt model, ref string Msg, Controller ctrl)
        {
            bool status = true;

            var obj = db.TB_TourRegion.Where(x => x.ID == model.ID).FirstOrDefault();
            db.TB_TourRegion.Remove(obj);
            db.SaveChanges();
            return status;
        }
 public bool Create(TB_TourRegionExt model, ref string Msg, Controller ctrl)
 {
     bool status = true;
     TB_TourRegion obj = new TB_TourRegion();
     obj.TourID = model.TourID;
     obj.RegionID = model.RegionID;
     obj.OpDateTime = DateTime.Now;
     obj.OpUserID = Convert.ToInt64(ctrl.Session["UserID"]);
     db.TB_TourRegion.Add(obj);
     db.SaveChanges();
     Int64 id = obj.ID;
     return status;
 }
        public List<TB_TourRegionExt> ReadAll(int TableID)
        {
            List<TB_TourRegionExt> list = new List<TB_TourRegionExt>();

            DataTable dt = new DataTable();
            SQLCon.Open();
            SqlCommand cmd = new SqlCommand("B_DisplayTableNew_BizTbl_Table_Sp", SQLCon);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@TableID", TableID);
            cmd.Parameters.AddWithValue("@CultureCode", CultureCode);
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            sda.Fill(dt);
            SQLCon.Close();

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    TB_TourRegionExt model = new TB_TourRegionExt();
                    model.ID = Convert.ToInt64(dr["ID"]);
                    model.Tour = dr["FK_TourID_ID"].ToString();
                    model.TourID = Convert.ToInt32(dr["TourID"].ToString());
                    model.RegionName = dr["FK_RegionID_ID"].ToString();
                    model.RegionID = Convert.ToInt32(dr["RegionID"].ToString());
                    list.Add(model);
                }
            }
            return list;
        }
 public bool Update(TB_TourRegionExt model, ref string Msg, Controller ctrl)
 {
     bool status = true;
     var obj = db.TB_TourRegion.Where(x => x.ID == model.ID).FirstOrDefault();
     obj.TourID = model.TourID;
     obj.RegionID = model.RegionID;
     obj.OpDateTime = DateTime.Now;
     obj.OpUserID = 0;
     db.SaveChanges();
     return status;
 }