Пример #1
0
        public async Task <NotificationTypeDto> AddAsync(NotificationTypeDto input)
        {
            using (var dbContext = _dbContextScopeFactory.Create())
            {
                var notificationType = NotificationType.Create(
                    input.Name, input.Description, input.Template, input.ModuleCode, input.ActionType);
                _notificationTypeRepository.Add(notificationType);
                dbContext.SaveChanges();
                await GetListAsync(true);

                return(_mapper.Map <NotificationTypeDto>(notificationType));
            }
        }
Пример #2
0
        public async Task <NotificationTypeDto> CopyAsync(Guid id)
        {
            using (var dbContext = _dbContextScopeFactory.Create())
            {
                var item = await _notificationTypeRepository.FindAsync(p => p.Id == id);

                var copyItem = NotificationType.Create(
                    item.Name, item.Description, item.Template, item.ModuleCode, item.ActionType);
                _notificationTypeRepository.Add(copyItem);
                dbContext.SaveChanges();
                await GetListAsync(true);

                return(_mapper.Map <NotificationTypeDto>(copyItem));
            }
        }