示例#1
0
        //[Authorization]
        public IActionResult Delete(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(toResponse(StatusCodeType.Error, "删除 Id 不能为空"));
            }

            if (_sysstandarService.Any(m => m.SystemTypeID == id))
            {
                return(toResponse(StatusCodeType.Error, $"添加体系类别编码已经被体系标准引用,请先删除标准!"));
            }

            var response = _systypeService.Delete(id);

            return(toResponse(response));
        }
示例#2
0
        //[Authorization]
        public IActionResult Create([FromBody] SysStandardCreateDto parm)
        {
            if (_sysstandarService.Any(m => m.SysStandardCode == parm.SysStandardCode))
            {
                return(toResponse(StatusCodeType.Error, $"添加编码 {parm.SysStandardCode} 已存在,不能重复!"));
            }
            if (_sysstandarService.Any(m => m.SysStandardReportCode == parm.SysStandardReportCode))
            {
                return(toResponse(StatusCodeType.Error, $"添加上报编 {parm.SysStandardReportCode} 已存在,不能重复!"));
            }
            if (_sysstandarService.Any(m => m.SysStandardShortName == parm.SysStandardShortName))
            {
                return(toResponse(StatusCodeType.Error, $"添加简称 {parm.SysStandardShortName} 已存在,不能重复!"));
            }
            //从 Dto 映射到 实体
            var options = parm.Adapt <Abi_SysStandard>().ToCreate(_tokenManager.GetSessionInfo());

            return(toResponse(_sysstandarService.Add(options)));
        }