Exemplo n.º 1
0
        public async Task ArchiveVoucherPlatform(EntityDto input)
        {
            var platform = await _voucherPlatformManager.FindAsync(input.Id);

            if (platform == null)
            {
                throw new UserFriendlyException(L("InvalidVoucherPlatform"));
            }

            platform.Archive(AbpSession.UserId);
        }
Exemplo n.º 2
0
        public async Task <EntityDto> CreateOrUpdateVoucherPlatform(BranchWithVoucherPlatformEditDto input)
        {
            var isEdit = input.Id > 0;

            BranchWithVoucherPlatform platform;
            Location        location;
            VoucherPlatform voucherPlatform;

            if (isEdit)
            {
                platform = await _locationManager.FindVoucherPlatformAsync(input.Id);

                if (platform == null)
                {
                    throw new UserFriendlyException(L("InvalidVoucherPlatform"));
                }
            }
            else
            {
                location = await _locationManager.FindLocationAsync(input.LocationId);

                voucherPlatform = await _voucherPlatformManager.FindAsync(input.VoucherPlatformId);

                platform = new BranchWithVoucherPlatform(location, voucherPlatform);
            }

            //location.VoucherPlatforms = new List<BranchWithVoucherPlatform>();
            platform.UpdateTime(input.Start, input.End);


            if (!isEdit)
            {
                await _locationManager.CreateBranchWithVoucherPlatformAsync(platform);
            }

            await CurrentUnitOfWork.SaveChangesAsync();

            return(new EntityDto(platform.Id));
        }