public async Task <AdminModel> UpdatePermissionsAsync([FromBody] AdminUpdatePermissionsModel model) { var(error, admin) = await _adminsService.UpdateAdminPermissionsAsync( model.AdminUserId.ToString(), _mapper.Map <List <Permission> >(model.Permissions)); switch (error) { case AdminServiceResponseError.None: return(_mapper.Map <AdminModel>(admin)); case AdminServiceResponseError.AdminUserDoesNotExist: throw LykkeApiErrorException.BadRequest(ApiErrorCodes.Service.AdminNotFound); default: throw new ArgumentOutOfRangeException(); } }
public async Task <AdminModel> UpdatePermissionsAsync([FromBody] AdminUpdatePermissionsModel model) { var(error, admin) = await _adminsService.UpdateAdminPermissionsAsync( model.AdminUserId.ToString(), _mapper.Map <List <Permission> >(model.Permissions)); if (error == AdminServiceResponseError.None) { await _auditLogPublisher.PublishAuditLogAsync(_requestContext.UserId, model.ToJson(), ActionType.UpdateAdminPermissions); return(_mapper.Map <AdminModel>(admin)); } switch (error) { case AdminServiceResponseError.AdminUserDoesNotExist: throw LykkeApiErrorException.BadRequest(ApiErrorCodes.Service.AdminNotFound); default: throw new ArgumentOutOfRangeException(); } }