Skip to content

IModelManager implementation with other technologies

Ushakov Michael edited this page Sep 22, 2025 · 4 revisions

Introduction

This page describes how to extend the default behavior and add to specific controllers additional methods. One-line controllers can't have additional methods (at the present moment).

Extend Controllers and Methods

To add new methods to controller you should do the following:

  1. Derive required basic controller and add custom method, i.e. code from an our CBS (Core Banking Solution) project:
namespace Wissance.Ubs.WebApi.Controllers
{

    public class LoanController: BasicCrudController<LoanDto, LoanEntity, Guid, EmptyAdditionalFilter>
    {
        public LoanController(EdgeDBClient edgeDbClient, ILoggerFactory loggerFactory, IHttpContextAccessor httpContextAccessor)
        {
            _manager = new LoanManager(edgeDbClient, LoanFactory.Create, LoanFactory.Create, CrudMasks.ReadUpdate, 
                loggerFactory, httpContextAccessor);
            Manager = _manager;
        }

        [HttpGet]
        [Route("api/[controller]/{loanId}/history")]
        public async Task<LoanHistoryItemDto[]> GetLoanHistoryAsync([FromRoute]Guid loanId)
        {
            OperationResultDto<LoanHistoryItemDto[]> result = await _manager.GetLoanHistoryAsync(loanId);
            if (result != null)
            {
                Response.StatusCode = result.Status;
                if (result.Success)
                    return result.Data;
            }

            Response.StatusCode = (int)StatusCodes.Status500InternalServerError;
            return null;
        }

        private readonly LoanManager _manager;
    }

Clone this wiki locally