예제 #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
        /// <summary>
        /// Add notification type
        /// </summary>
        /// <param name="notificationType"></param>
        /// <returns></returns>
        public int AddNotificationType(NotificationTypeDomain notificationType)
        {
            ValidateNotificationTypeModel(notificationType);

            bool codeExists = _repository.GetAllByCode(notificationType.Code).Count > 0;

            ValidationHelper.IsFalse(codeExists, NotificationMessages.NotificationTypeCodeExists);

            return(_repository.Add(notificationType));
        }