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)); }
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)); }
public async Task <long> DeleteAsync(SysRolesModel model) { return(await DbContext.DeleteAsync(model)); }
public async Task <bool> CreateAsync(SysRolesModel model) { return(await DbContext.CreateAsync(model)); }
public async Task <long> UpdateAllModelAsync(SysRolesModel model) { return(await DbContext.UpdateAllModelAsync(model)); }
public async Task <long> UpdateModelAsync(SysRolesModel model) { return(await sysRolesRepository.UpdateModelAsync(model)); }
public async Task <long> DeleteAsync(SysRolesModel model) { return(await sysRolesRepository.DeleteAsync(model)); }
//解决依赖循环问题private { get => AutofacHelper.GetScopeService<ISysRolesRepository>(); } public async Task <bool> CreateAsync(SysRolesModel model) { return(await sysRolesRepository.CreateAsync(model)); }