Ejemplo n.º 1
0
        public ActionResult Edit(Guid Id)
        {
            ViewBag.Id        = Id;
            ViewBag.IsForUser = CongressComponent.Instance.BaseInfoComponents.UserFormsFacade.Get(this.Homa.Id, Id) !=
                                null;
            var firstOrDefault =
                FormGeneratorComponent.Instance.FormAssigmentFacade.FirstOrDefault(x => x.FormStructureId == Id);

            ViewBag.Datas = new SelectList(AppExtention.GetFormList(), "Key", "Value",
                                           firstOrDefault != null ? firstOrDefault.Url : "");
            TempData["Containers"] =
                new SelectList(
                    CongressComponent.Instance.BaseInfoComponents.CongressContainerFacade.SelectKeyValuePair(
                        x => x.ContainerId, x => x.Container.Title, x => x.CongressId == this.Homa.Id), "Key", "Value");
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult Edit(Guid Id, FormCollection collection)
        {
            var formStructure = FormGeneratorComponent.Instance.FormStructureFacade.Get(Id);

            try
            {
                var forUser = collection["ForUser"].ToBool();
                var url     = collection["Selected"];
                this.RadynTryUpdateModel(formStructure, collection);
                if (forUser)
                {
                    url = null;
                }
                if (CongressComponent.Instance.BaseInfoComponents.CongressFormsFacade.UpdateAndAssgine(this.Homa.Id,
                                                                                                       formStructure, url, forUser))
                {
                    ShowMessage(Resources.Common.UpdateSuccessMessage, Resources.Common.MessaageTitle,
                                messageIcon: MessageIcon.Succeed);
                    return(Redirect("~/Congress/CongressForms/Index"));
                }
                ShowMessage(Resources.Common.ErrorInEdit, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error);
                return(Redirect("~/Congress/CongressForms/Index"));
            }
            catch (Exception exception)
            {
                ShowExceptionMessage(exception);
                ViewBag.Id = Id;
                var firstOrDefault =
                    FormGeneratorComponent.Instance.FormAssigmentFacade.FirstOrDefault(x => x.FormStructureId == Id);
                ViewBag.Datas = new SelectList(AppExtention.GetFormList(), "Key", "Value",
                                               firstOrDefault != null ? firstOrDefault.Url : "");
                TempData["Containers"] =
                    new SelectList(
                        CongressComponent.Instance.BaseInfoComponents.CongressContainerFacade.SelectKeyValuePair(
                            x => x.Container.Id, x => x.Container.Title, x => x.CongressId == this.Homa.Id), "Key",
                        "Value");
                return(View());
            }
        }