コード例 #1
0
ファイル: CompanyInfoController.cs プロジェクト: sajidur/erp
        public dynamic Delete(CompanyInfo model)
        {
            try
            {
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "You are Not Allowed to Delete Record");

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));

                var data = _companyInfoService.GetObjectById(model.Id);
                model = _companyInfoService.SoftDeleteObject(data, _branchOfficeService);
            }

            catch (Exception ex)
            {
                LOG.Error("Delete Failed", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        public dynamic Delete(CompanyInfo model)
        {
            try
            {
                if (!AuthenticationModel.IsAllowed("Delete", Core.Constants.Constant.MenuName.CompanyInfo, Core.Constants.Constant.MenuGroupName.Master))
                {
                    Dictionary <string, string> Errors = new Dictionary <string, string>();
                    Errors.Add("Generic", "You are Not Allowed to Delete Record");

                    return(Json(new
                    {
                        Errors
                    }, JsonRequestBehavior.AllowGet));
                }

                var data = _companyInfoService.GetObjectById(model.Id);
                model = _companyInfoService.SoftDeleteObject(data, _branchOfficeService);
            }

            catch (Exception ex)
            {
                LOG.Error("Delete Failed", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Errors
            }));
        }