public async Task <ActionResult> Index(CCtrl_DBAccess_Act_Index_VwMd p_Model) { p_Model = new CCtrl_DBAccess_Act_Index_VwMd(); p_Model.List_CTbMember_DataModel = await Get_Data(p_Model.ID, p_Model.Name); return(View(p_Model)); }
public async Task <ActionResult> Index_Btn_Add_Click(CCtrl_DBAccess_Act_Index_VwMd p_Model) { DBAccess <CTbMember_DataModel> _dBAccess = new DBAccess <CTbMember_DataModel>(); //=== string TpSQL = "INSERT INTO tbMember (name) OUTPUT Inserted.id VALUES (@NAME)"; //=== Object Tp_Para = new { NAME = p_Model.Name }; //=== Tuple <int, string> Tp_Tuple = await _dBAccess.Execute(TpSQL, Tp_Para); //=== if (Convert.ToInt64(Tp_Tuple.Item1) > 0 && Tp_Tuple.Item2.ToString() == string.Empty) { TempData["message_type"] = "success"; TempData["message"] = "新增會員成功"; } else { TempData["message_type"] = "error"; TempData["message"] = "新增失敗:" + Tp_Tuple.Item2.ToString(); } //=== p_Model.List_CTbMember_DataModel = await Get_Data(); return(View(p_Model)); }
public async Task <ActionResult> Index_Btn_Delete_Click(CCtrl_DBAccess_Act_Index_VwMd p_Model) { DBAccess <CTbMember_DataModel> _dBAccess = new DBAccess <CTbMember_DataModel>(); //=== string TpSQL = @"delete from tbMember where id=@MEMBER_ID"; //=== Object Tp_Para = new { MEMBER_ID = p_Model.ID }; //=== Tuple <int, string> Tp_Tuple = await _dBAccess.Execute(TpSQL, Tp_Para); //=== if (Convert.ToInt64(Tp_Tuple.Item1) > 0 && Tp_Tuple.Item2.ToString() == string.Empty) { TempData["message_type"] = "success"; TempData["message"] = "刪除會員成功"; } else { TempData["message_type"] = "error"; TempData["message"] = "刪除失敗:" + Tp_Tuple.Item2.ToString(); } //=== p_Model.List_CTbMember_DataModel = await Get_Data(); return(View(p_Model)); }