Example #1
0
        public async Task <ActionResult> New(string tabId, int parentId)
        {
            var action = _service.New();
            var model  = CustomActionViewModel.Create(action, tabId, parentId, _service);

            return(await JsonHtml("Properties", model));
        }
Example #2
0
        public ActionResult Copy(string tabId, int parentId, int id, IFormCollection collection)
        {
            var action = _service.ReadForModify(id);
            var model  = CustomActionViewModel.Create(action, tabId, parentId, _service);
            var result = _service.Copy(id, model.SelectedActionsIds);

            return(JsonMessageResult(result.Message));
        }
Example #3
0
        public async Task <ActionResult> Properties(string tabId, int parentId, int id, string successfulActionCode)
        {
            var action = _service.Read(id);
            var model  = CustomActionViewModel.Create(action, tabId, parentId, _service);

            model.SuccesfulActionCode = successfulActionCode;
            return(await JsonHtml("Properties", model));
        }
        public IActionResult AddNewAction(string command, int sequence)
        {
            var customCommand = j64Config.CustomCommands.Find(x => x.CommandName == command);

            var cav = new CustomActionViewModel()
            {
                Command  = command,
                Sequence = sequence,
            };

            cav.Devices = myHub.hubConfig.device;

            return(View(cav));
        }
Example #5
0
        public async Task <ActionResult> Properties(string tabId, int parentId, int id, IFormCollection collection)
        {
            var action = _service.ReadForModify(id);
            var model  = CustomActionViewModel.Create(action, tabId, parentId, _service);

            await TryUpdateModelAsync(model);

            if (ModelState.IsValid)
            {
                model.Data = _service.Update(model.Data, model.SelectedActionsIds);
                return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.UpdateCustomAction }));
            }

            return(await JsonHtml("Properties", model));
        }
Example #6
0
        public ActionResult New(string tabId, int parentId, int id, FormCollection collection)
        {
            var action = _service.NewForSave();
            var model  = CustomActionViewModel.Create(action, tabId, parentId, _service);

            TryUpdateModel(model);
            model.Validate(ModelState);
            if (ModelState.IsValid)
            {
                model.Data = _service.Save(model.Data, model.SelectedActionsIds);
                PersistResultId(model.Data.Id);
                PersistActionId(model.Data.ActionId);
                PersistActionCode(model.Data.Action.Code);
                return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.SaveCustomAction }));
            }

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