コード例 #1
0
    public async Task <IResult> HandleResetCredentials(RegenerateApiClientSecretCommand resetSecretCommand, IMapper mapper, int id)
    {
        var resetApplicationSecret = await Task.Run(() => resetSecretCommand.Execute(id));

        var model = mapper.Map <ApplicationResult>(resetApplicationSecret);

        return(AdminApiResponse <ApplicationResult> .Updated(model, "Application secret"));
    }
コード例 #2
0
        public async Task <IResult> Handle(EditVendorCommand editVendorCommand, IMapper mapper,
                                           Validator validator, Request request, int id)
        {
            request.VendorId = id;
            await validator.GuardAsync(request);

            var updatedVendor = editVendorCommand.Execute(request);
            var model         = mapper.Map <VendorModel>(updatedVendor);

            return(AdminApiResponse <VendorModel> .Updated(model, "Vendor"));
        }
コード例 #3
0
        public async Task <IResult> Handle(IEditApplicationCommand editApplicationCommand, IMapper mapper,
                                           Validator validator, IUsersContext db, Request request, int id)
        {
            request.ApplicationId = id;
            await validator.GuardAsync(request);

            GuardAgainstInvalidEntityReferences(request, db);

            var updatedApplication = editApplicationCommand.Execute(request);
            var model = mapper.Map <ApplicationModel>(updatedApplication);

            return(AdminApiResponse <ApplicationModel> .Updated(model, "Application"));
        }