Esempio n. 1
0
        public async Task <int> UpdateAsync(NotificationTemplateCrtVM notificationTemplateCrtVM)
        {
            var notificationTemplateEntity = Mapper.Map(notificationTemplateCrtVM, notificationTemplate);
            var result = await notificationTemplateRepository.UpdateAsync(notificationTemplateEntity);

            return(result);
        }
        protected async override Task OnInitializedAsync()
        {
            NotificationValues = await SessionStorageService.GetItemAsync <NotificationNames>(Id);

            DefaultSelectedNotificationType    = "Select Notification Type";
            DefaultSelectedNotificationChannel = "Select Notification Channel";
            if (!string.IsNullOrEmpty(Id))
            {
                var id = int.Parse(Id);
                if (id > 0)
                {
                    notificationTemplateCrtVM = await NotificationTemplateService.FetchByIdAsync(id);

                    NotificationId = notificationTemplateCrtVM.Id;

                    DefaultSelectedNotificationType       = NotificationValues.NotificationTypeName == null
                        ? DefaultSelectedNotificationType = "Select Notification Type" : NotificationValues.NotificationTypeName;

                    DefaultSelectedNotificationChannel       = NotificationValues.NotificationChannelName == null
                        ? DefaultSelectedNotificationChannel = "Select Notification Channel" : NotificationValues.NotificationChannelName;
                }

                notificationTypeVMs = await NotificationTypeService.FetchAllAsync();

                notificationChannelVMs = await NotificationChannelService.FetchAllAsync();
            }
        }
Esempio n. 3
0
        public async Task <int> CreateAsync(NotificationTemplateCrtVM notificationTemplateCrtVM)
        {
            int result = 0;

            try
            {
                //var notificationTemplateEntity = Mapper.Map(notificationTemplateCrtVM, notificationTemplate);
                notificationTemplate.Name                  = notificationTemplateCrtVM.Name;
                notificationTemplate.Description           = notificationTemplateCrtVM.Description;
                notificationTemplate.NotificationTypeId    = notificationTemplateCrtVM.NotificationTypeId;
                notificationTemplate.NotificationChannelId = notificationTemplateCrtVM.NotificationChannelId;
                result = await notificationTemplateRepository.AddAsync(notificationTemplate);

                return(result);
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
                return(result);
            }
        }