コード例 #1
0
        public ActionResult <RightsAddResModel> Manage_Rights_add(RightsAddViewModel rightsAddViewModel)
        {
            int Rights_Add_Count;

            Rights_Add_Count = _rightsService.Rights_Add(rightsAddViewModel);
            RightsAddResModel rightsAddResModel = new RightsAddResModel();

            if (Rights_Add_Count > 0)
            {
                rightsAddResModel.IsSuccess                  = true;
                rightsAddResModel.AddCount                   = Rights_Add_Count;
                rightsAddResModel.baseViewModel.Message      = "添加成功";
                rightsAddResModel.baseViewModel.ResponseCode = 200;
                //_ILogger.Information("增添权限信息成功");
                return(Ok(rightsAddResModel));
            }
            else
            {
                rightsAddResModel.IsSuccess                  = false;
                rightsAddResModel.AddCount                   = 0;
                rightsAddResModel.baseViewModel.Message      = "添加失败";
                rightsAddResModel.baseViewModel.ResponseCode = 400;
                //_ILogger.Information("增添权限信息失败");
                return(BadRequest(rightsAddResModel));
            }
        }
コード例 #2
0
ファイル: RightsService.cs プロジェクト: outman000/Intellect
        //添加权限
        public int Rights_Add(RightsAddViewModel rightsAddViewModel)
        {
            var user_Rights = _IMapper.Map <RightsAddViewModel, User_Rights>(rightsAddViewModel);

            _IUserRightsRepository.Add(user_Rights);
            return(_IUserRightsRepository.SaveChanges());
        }