ActionResponse 1.3.7

There is a newer version of this package available.
See the version list below for details.
dotnet add package ActionResponse --version 1.3.7                
NuGet\Install-Package ActionResponse -Version 1.3.7                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ActionResponse" Version="1.3.7" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ActionResponse --version 1.3.7                
#r "nuget: ActionResponse, 1.3.7"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ActionResponse as a Cake Addin
#addin nuget:?package=ActionResponse&version=1.3.7

// Install ActionResponse as a Cake Tool
#tool nuget:?package=ActionResponse&version=1.3.7                

ActionResponse

A wrapper object meant to unify all return types inside your application. Has built in markers and checkers for the result type making it easy to handle success or error inside the application.

A real life example:

    public async Task<ActionResponse> Update(PartnerUpdateRequest request)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
                {
                    var entityToUpdate = serviceBase.UnitOfWork.GetGenericRepository<Partner, int>()
                        .GetActive(e => e.Id == request.Id)
                        .Include(e => e.Currencies.Where(e => e.IsDeleted == DatabaseEntityStatus.Active))
                        .Include(e => e.PartnerTypes.Where(e => e.IsDeleted == DatabaseEntityStatus.Active))
                        .Include(e => e.Sites.Where(e => e.IsDeleted == DatabaseEntityStatus.Active))
                        .Include(e => e.TaxTypes.Where(e => e.IsDeleted == DatabaseEntityStatus.Active))
                        .First();

                    serviceBase.Mapper.Map(request, entityToUpdate);
                    if (ModifyPartnerCurrencies(entityToUpdate.Currencies, request.Currencies).IsNotSuccess(out ActionResponse childResponse))
                    {
                        return childResponse;
                    }

                    if (ModifyPartnerTypes(entityToUpdate.PartnerTypes, request.PartnerTypes).IsNotSuccess(out childResponse))
                    {
                        return childResponse;
                    }

                    if (ModifyPartnerSites(entityToUpdate.Sites, request.Sites).IsNotSuccess(out childResponse))
                    {
                        return childResponse;
                    }

                    if (ModifyPartnerTaxTypes(entityToUpdate.TaxTypes, request.TaxTypes).IsNotSuccess(out childResponse))
                    {
                        return childResponse;
                    }

                    var entityChooser = new EntityChooser
                    {
                        EntityId = request.Id.Value,
                        EntityType = EntityType.Partner
                    };

                    if ((await entityAddressService.ModifyEntityAddresses(entityChooser, request.Addresses))
                        .IsNotSuccess(out ActionResponse modifyResponse))
                    {
                        return modifyResponse.Convert<int>();
                    }

                    if ((await entityContactService.ModifyEntityContacts(entityChooser, request.Contacts))
                        .IsNotSuccess(out modifyResponse))
                    {
                        return modifyResponse.Convert<int>();
                    }

                    // Notice that this enables Cascade Soft Delete as well :D
                    await serviceBase.UnitOfWork.SaveAsync(request.ApplicationActionId);

                    scope.Complete();

                    return ActionResponse.Success(Code: 204);
                }
            }
            catch (Exception ex)
            {
                serviceBase.Logger.LogError(serviceBase.StringLocalizer.GetString(Resources.UpdateError), ex, JsonConvert.SerializeObject(request));
                return ActionResponse.Error(Message: serviceBase.StringLocalizer.GetString(Resources.UpdateError));
            }
        }
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net5.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ActionResponse:

Package Downloads
ActionResponse_Api

A package meant to act as a wrapper for API calls.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.8 191 7/12/2024
1.3.7 84 7/12/2024
1.3.6 3,696 4/7/2022
1.3.5 340 12/8/2021
1.3.4 293 12/8/2021