Ejemplo n.º 1
0
 public ModifyViewModel BuildViewModel(ToolLinkInputModel toolLinkInputModel)
 {
     return new ModifyViewModel()
            	{
            		ToolLinkInputModel = toolLinkInputModel,
            	};
 }
        public ActionResult Create(ToolLinkInputModel toolLinkInputModel)
        {
            if (!ModelState.IsValid)
                return View("Modify", modifyViewModelBuilder.BuildViewModel(toolLinkInputModel));

            var newTreeNodeId = treeNodeSummaryContext.Create(toolLinkInputModel.ParentTreeNodeId, typeof(ToolLinkNodeProvider).AssemblyQualifiedName);

            var toolLinkProviderDraft = new ToolLinkProviderDraft()
                        {
                            Id = newTreeNodeId,
                            Hidden = toolLinkInputModel.Hidden,
                            Name = toolLinkInputModel.Name,
                            Inactive = toolLinkInputModel.Inactive,
                            Url = toolLinkInputModel.Url,
                            UrlSegment = toolLinkInputModel.UrlSegment,
                            Sequence = toolLinkInputModel.Sequence,
                            LastModifyDate = DateTime.Now,
                            LastModifyBy = currentUserContext.GetCurrentPrincipal().Identity.Name
                        };
            toolLinkProviderDraftRepository.SaveAndReturnId(toolLinkProviderDraft);

            return new RedirectResult(GetRedirectUrlToModifyMethod(toolLinkProviderDraft));
        }
        public ActionResult Modify(ToolLinkInputModel toolLinkInputModel)
        {
            if (!ModelState.IsValid)
                return View("Modify", modifyViewModelBuilder.BuildViewModel(toolLinkInputModel));

            var toolLinkProviderDraft = new ToolLinkProviderDraft()
                                            {
                                                Hidden = toolLinkInputModel.Hidden,
                                                Inactive = toolLinkInputModel.Inactive,
                                                Name = toolLinkInputModel.Name,
                                                Url = toolLinkInputModel.Url,
                                                UrlSegment = toolLinkInputModel.UrlSegment,
                                                Id = toolLinkInputModel.TreeNodeId,
                                                Sequence = toolLinkInputModel.Sequence,
                                                LastModifyDate = DateTime.Now,
                                                LastModifyBy = currentUserContext.GetCurrentPrincipal().Identity.Name
                                            };

            toolLinkProviderDraftRepository.SaveAndReturnId(toolLinkProviderDraft);

            return new RedirectResult(GetRedirectUrlToModifyMethod(toolLinkProviderDraft));
        }