Exemplo n.º 1
0
        /// <summary>
        /// 删除菜单
        /// </summary>
        /// <param name="requestModel">参数</param>
        /// <returns></returns>
        public ApiResultModel <int> Delete(BaseIdModel requestModel)
        {
            var result = new ApiResultModel <int>();

            if (requestModel.Id.IsNullOrEmpty())
            {
                result.Message = "菜单ID不能为空";
                return(result);
            }
            var menus = _menuRepository.Find(x => x.id == requestModel.Id || x.parentId == requestModel.Id).ToList();

            if (!menus.Any(x => x.id == requestModel.Id))
            {
                result.Message = "菜单不存在";
                return(result);
            }
            else if (menus.Any(x => x.parentId == requestModel.Id))
            {
                result.Message = "该菜单存在子级,不能删除";
                return(result);
            }
            var menu = menus.FirstOrDefault(x => x.id == requestModel.Id);

            //_db.Entry(menu).State = EntityState.Deleted;
            //_db.SaveChanges();
            _menuRepository.Delete(menu);
            _menuRepository.SaveChanges();

            result.Code = ApiResultCode.Success;
            return(result);
        }
Exemplo n.º 2
0
        public void ExcelHumUrgentyNotificationTest()
        {
            var model = new BaseIdModel("en", 45820000633, false)
            {
                ExportFormat = ReportExportType.Xlsx.ToString()
            };

            byte[] bytes = m_Facade.ExportHumUrgentyNotification(model);
            AssertXLSX(bytes);
        }
Exemplo n.º 3
0
        public void RtfHumUrgentyNotificationTest()
        {
            var model = new BaseIdModel("en", 45820000633, false)
            {
                ExportFormat = ReportExportType.Rtf.ToString()
            };

            byte[] bytes = m_Facade.ExportHumUrgentyNotification(model);
            //     File.WriteAllBytes("C:\\1.rtf", bytes);
            AssertRTF(bytes);
        }
Exemplo n.º 4
0
 public ApiResultModel <QueryUserResponseModel> GetOne(BaseIdModel idModel)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 5
0
 public ApiResultModel <int> Delete(BaseIdModel idModel)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 6
0
 public ApiResultModel <QueryRoleResponseModel> GetOne(BaseIdModel idModel)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 7
0
 public ApiResultModel <int> Delete(BaseIdModel requestModel)
 {
     return(_menuService.Delete(requestModel));
 }