示例#1
0
        public async Task <ActionResult> New(string tabId, int parentId)
        {
            var notification = _notificationService.NewNotificationProperties(parentId);
            var model        = NotificationViewModel.Create(notification, tabId, parentId, _notificationService);

            return(await JsonHtml("Properties", model));
        }
示例#2
0
        public async Task <ActionResult> New(string tabId, int parentId, IFormCollection collection)
        {
            var notification = _notificationService.NewNotificationPropertiesForUpdate(parentId);
            var model        = NotificationViewModel.Create(notification, tabId, parentId, _notificationService);

            await TryUpdateModelAsync(model);

            if (ModelState.IsValid)
            {
                try
                {
                    model.Data = _notificationService.SaveNotificationProperties(model.Data, model.CreateDefaultFormat, CommonHelpers.GetBackendUrl(HttpContext));
                    PersistResultId(model.Data.Id);
                    if (model.CreateDefaultFormat)
                    {
                        PersistNotificationFormatId(model.Data.FormatId);
                    }

                    return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.SaveNotification }));
                }
                catch (ActionNotAllowedException nae)
                {
                    ModelState.TryAddModelException("OperationIsNotAllowedForAggregated", nae);
                    return(await JsonHtml("Properties", model));
                }
            }

            return(await JsonHtml("Properties", model));
        }
示例#3
0
        public async Task <ActionResult> Properties(string tabId, int parentId, int id, string successfulActionCode)
        {
            var notification = _notificationService.ReadNotificationProperties(id);

            ViewData[SpecialKeys.IsEntityReadOnly] = notification.WorkFlowId.HasValue;
            var model = NotificationViewModel.Create(notification, tabId, parentId, _notificationService);

            model.SuccesfulActionCode = successfulActionCode;
            return(await JsonHtml("Properties", model));
        }
示例#4
0
        public async Task <ActionResult> Properties(string tabId, int parentId, int id, IFormCollection collection)
        {
            var notification = _notificationService.ReadNotificationPropertiesForUpdate(id);
            var model        = NotificationViewModel.Create(notification, tabId, parentId, _notificationService);

            await TryUpdateModelAsync(model);

            if (ModelState.IsValid)
            {
                model.Data = _notificationService.UpdateNotificationProperties(model.Data, model.CreateDefaultFormat, CommonHelpers.GetBackendUrl(HttpContext));
                if (model.CreateDefaultFormat)
                {
                    PersistNotificationFormatId(model.Data.FormatId);
                }

                return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.UpdateNotification }));
            }

            return(await JsonHtml("Properties", model));
        }