Ejemplo n.º 1
0
        public ActionResult SettingEvt(int[] SettingID, string Action)
        {
            // You have your books IDs on the deleteInputs array
            switch (Action.ToLower())
            {
            case "delete":

                if (SettingID != null && SettingID.Length > 0)
                {
                    int     length = SettingID.Length;
                    Setting objItem;
                    for (int i = 0; i <= length - 1; i++)
                    {
                        objItem = SettingManager.GetById(SettingID[i], CurrentUser.CompanyID);
                        if (objItem != null)
                        {
                            SettingManager.Delete(objItem);
                        }
                    }
                    return(View(ViewFolder + "list.cshtml", SettingManager.GetAll(CurrentUser.CompanyID)));
                }
                break;
            }


            return(View("PostFrm"));
        }
        public IActionResult Delete(int id)
        {
            int count = SM.Delete(id);

            if (count > 0)
            {
                return(Json("Success"));
            }
            else
            {
                return(Json("Fail"));
            }
        }
Ejemplo n.º 3
0
 private void DeleteSetting()
 {
     if (settingBindingSource != null)
     {
         var dResult = MessageBox.Show(@"Delete current record?", @"Delete", MessageBoxButtons.YesNo,
                                       MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
         if (dResult == DialogResult.Yes)
         {
             if (SettingManager.Delete(((Setting)settingBindingSource.Current).SettingId))
             {
                 MessageBox.Show(@"Record was deleted successfully.", @"Delete", MessageBoxButtons.OK,
                                 MessageBoxIcon.Information);
                 settingBindingSource.RemoveCurrent();
             }
             else
             {
                 MessageBox.Show(@"Error on delete operation.", @"Delete", MessageBoxButtons.OK,
                                 MessageBoxIcon.Error);
                 settingDataGridView.Focus();
             }
         }
     }
 }