Example #1
0
        public async Task <IActionResult> Post([FromBody] SysRolesRequestModel parameter)
        {
            var apiResult = new ApiResultModel(ErrorCodeType.Success);
            var model     = new SysRolesModel();

            parameter.CloneTo(model);
            if (await sysRolesService.CreateAsync(model))
            {
                return(Created($"{route}/{parameter.role_id}", apiResult));
            }
            apiResult.Code = ErrorCodeType.PostError;
            return(BadRequest(apiResult));
        }
Example #2
0
        public async Task <IActionResult> Patch([FromBody] SysRolesModel parameter)
        {
            var apiResult = new ApiResultModel(ErrorCodeType.Success);
            //var model = new SysRolesModel();
            //parameter.CloneTo(model);
            var c = await sysRolesService.UpdateModelAsync(parameter);

            if (c > 0)
            {
                return(Ok(apiResult));
            }
            apiResult.Code = ErrorCodeType.PutError;
            return(BadRequest(apiResult));
        }
Example #3
0
 public async Task <long> DeleteAsync(SysRolesModel model)
 {
     return(await DbContext.DeleteAsync(model));
 }
Example #4
0
 public async Task <bool> CreateAsync(SysRolesModel model)
 {
     return(await DbContext.CreateAsync(model));
 }
Example #5
0
 public async Task <long> UpdateAllModelAsync(SysRolesModel model)
 {
     return(await DbContext.UpdateAllModelAsync(model));
 }
Example #6
0
 public async Task <long> UpdateModelAsync(SysRolesModel model)
 {
     return(await sysRolesRepository.UpdateModelAsync(model));
 }
Example #7
0
 public async Task <long> DeleteAsync(SysRolesModel model)
 {
     return(await sysRolesRepository.DeleteAsync(model));
 }
Example #8
0
        //解决依赖循环问题private { get => AutofacHelper.GetScopeService<ISysRolesRepository>(); }


        public async Task <bool> CreateAsync(SysRolesModel model)
        {
            return(await sysRolesRepository.CreateAsync(model));
        }