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)); } }
/// <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)); }