public ActionResult Actions()
        {
            var msg = new JsonMessage {
                Erros = false
            };
            var url = Request.Form.ToString();

            url = HttpUtility.UrlDecode(url);
            var lstID = string.Join(",", ArrId);

            switch (DoAction)
            {
            case ActionType.Add:
                msg = _api.Add(url, UserItem.UserId);
                break;

            case ActionType.Edit:
                msg = _api.Update(url, UserItem.UserId);
                break;

            case ActionType.Delete:
                msg = _api.Delete(lstID);
                break;
            }
            if (string.IsNullOrEmpty(msg.Message))
            {
                msg.Message = "Không có hành động nào được thực hiện.";
                msg.Erros   = true;
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
        private void DeleteCompany()
        {
            EraseYearWindow EraseYearWindowDialog = new EraseYearWindow(editrow.CompanyName, false);

            EraseYearWindowDialog.Closed += async delegate
            {
                if (EraseYearWindowDialog.DialogResult == true)
                {
                    CompanyAPI compApi = new CompanyAPI(api);
                    var        res     = await compApi.Delete();

                    if (res != ErrorCodes.Succes)
                    {
                        UtilDisplay.ShowErrorCode(res);
                    }
                    else
                    {
                        var companiesTemp = Controls.CWDefaultCompany.loadedCompanies.ToList();
                        companiesTemp.Remove(editrow);
                        Controls.CWDefaultCompany.loadedCompanies = companiesTemp.ToArray();

                        var defCompId = session.User._DefaultCompany;
                        //Check to Ensure that User hasn't deleted his own default company
                        var comp = companiesTemp.Where(c => c.CompanyId == defCompId).SingleOrDefault();

                        if (comp != null)
                        {
                            globalEvents.OnRefresh(TabControls.CreateCompany, comp.CompanyId);
                        }
                        else
                        {
                            globalEvents.OnRefresh(TabControls.CreateCompany, companiesTemp.FirstOrDefault());
                        }

                        dockCtrl?.CloseAllDocuments(true);
                    }
                }
            };
            EraseYearWindowDialog.Show();
        }