public async Task <ResponseDTO> Update(AmigoTenantTRoleDTO dto) { var command = _mapper.Map <AmigoTenantTRoleDTO, UpdateAmigoTenantTRoleCommand>(dto); var resp = await _bus.SendAsync(command); return(ResponseBuilder.Correct(resp)); }
public async Task <ResponseDTO> Update(AmigoTenantTRoleDTO dto) { if (ModelState.IsValid) { var permssions = (IPermissionsReader)GlobalConfiguration.Configuration.DependencyResolver.GetService(typeof(IPermissionsReader)); var result = await _AmigoTenantTRoleApplicationService.Update(dto).ConfigureAwait(false); await permssions.UpdatePermissionsCache().ConfigureAwait(false); return(result); } return(ModelState.ToResponse()); }
public async Task <ResponseDTO> Register(AmigoTenantTRoleDTO dto) { var command = _mapper.Map <AmigoTenantTRoleDTO, RegisterAmigoTenantTRoleCommand>(dto); var searchRequest = new AmigoTenantTRoleSearchRequest() { AmigoTenantTRoleId = dto.AmigoTenantTRoleId, Code = dto.Code }; var exists = await ExistsToSave(searchRequest); if (exists) { return(ResponseBuilder.InCorrect().WithMessages(new ApplicationMessage() { Message = Constants.Entity.AmigoTenantTRole.ErrorMessage.RoleExist })); } var resp = await _bus.SendAsync(command); return(ResponseBuilder.Correct(resp)); }