Пример #1
0
        public ActionResult <NotificationConfigViewModel> GetConfig(string type)
        {
            var config = BaseNotificationConfig.GetConfig(type);

            if (config != null)
            {
                return(Ok(_mapper.Map <BaseNotificationConfig, NotificationConfigViewModel>(config)));
            }

            return(NotFound());
        }
        public List <NotificationOptionViewModel> Resolve(Notification source, NotificationViewModel destination, List <NotificationOptionViewModel> destMember, ResolutionContext context)
        {
            var config = BaseNotificationConfig.GetConfig(source.Type);
            var stored = JsonConvert.DeserializeObject <IList <NotificationOptionViewModel> >(source.Config)
                         .Select(v => new NotificationOptionViewModel(
                                     v.Value,
                                     v.Key,
                                     config.Options[v.Key].Label,
                                     config.Options[v.Key].Description,
                                     config.Options[v.Key].Required,
                                     config.Options[v.Key].ControlType
                                     ));

            return(stored.ToList());
        }