Example #1
0
        protected AboutLinksViewModel ToViewModel(GetAboutLinksQueryResult result)
        {
            AboutLinksViewModel vm = Mapper.Map <AboutLinksViewModel>(result.Links);

            vm.ImageUrl = result.ImageUrl;
            return(vm);
        }
Example #2
0
        public ActionResult Links()
        {
            GetAboutLinksQueryResult result = Query.For <GetAboutLinksQueryResult>().With(new EmptyCriterion());
            AboutLinksViewModel      vm     = ToViewModel(result);

            return(View(vm));
        }
Example #3
0
        public ActionResult Links(AboutLinksViewModel vm)
        {
            EditAboutLinksCommand command = new EditAboutLinksCommand
            {
                Links = ToModel(vm)
            };

            if (vm.Image != null)
            {
                var result = SaveAs(vm.Image, PlatformConfiguration.UploadedSettingsPath);

                if (result != null && result.ResultCode == CommandResultCode.Success)
                {
                    command.File = result.File;
                }
            }

            Command.Execute(command);

            return(RedirectToAction("Index"));
        }
Example #4
0
        protected AboutLinks ToModel(AboutLinksViewModel vm)
        {
            AboutLinks model = Mapper.Map <AboutLinks>(vm);

            return(model);
        }