Ejemplo n.º 1
0
        public async Task <CoaUnitDto> CreateCoaUnit(CreateCoaUnitInput input)
        {
            var coaUnit = input.MapTo <CoaUnit>();

            coaUnit.OrganizationUnitId = input.OrganizationUnitId;
            await _coaunitManager.CreateAsync(coaUnit);

            await CurrentUnitOfWork.SaveChangesAsync();

            #region Example to show the usage of Event Bus as well Unit of Work Completion

            _unitOfWorkManager.Current.Completed += (sender, args) =>
            {
                /*Do Something when the Chart of Account is Added*/
            };

            EventBus.Register <EntityChangedEventData <CoaUnit> >(
                eventData =>
            {
                // http://www.aspnetboilerplate.com/Pages/Documents/EventBus-Domain-Events#DocTriggerEvents
                //Do something when COA is added
            });

            #endregion

            return(coaUnit.MapTo <CoaUnitDto>());
        }
Ejemplo n.º 2
0
        public async Task <CoaUnitDto> CreateProjectCoaUnit(CreateCoaUnitInput input)
        {
            var coaUnit = input.MapTo <CoaUnit>();
            await _coaunitManager.CreateAsync(coaUnit);

            coaUnit.OrganizationUnitId = input.OrganizationUnitId;
            coaUnit.IsCorporate        = false;
            await CurrentUnitOfWork.SaveChangesAsync();

            return(coaUnit.MapTo <CoaUnitDto>());
        }