コード例 #1
0
        public ActionResult Edit(int Id)
        {
            Post byId = this._postService.GetById(Id);

            PostViewModel modelMap = Mapper.Map <Post, PostViewModel>(byId);

            ((dynamic)base.ViewBag).Galleries = byId.GalleryImages;

            //Add Locales to model
            AddLocales(_languageService, modelMap.Locales, (locale, languageId) =>
            {
                locale.Id              = modelMap.Id;
                locale.LocalesId       = modelMap.Id;
                locale.Title           = modelMap.GetLocalized(x => x.Title, Id, languageId, false, false);
                locale.ProductCode     = modelMap.GetLocalized(x => x.ProductCode, Id, languageId, false, false);
                locale.ShortDesc       = modelMap.GetLocalized(x => x.ShortDesc, Id, languageId, false, false);
                locale.Description     = modelMap.GetLocalized(x => x.Description, Id, languageId, false, false);
                locale.TechInfo        = modelMap.GetLocalized(x => x.TechInfo, Id, languageId, false, false);
                locale.MetaTitle       = modelMap.GetLocalized(x => x.MetaTitle, Id, languageId, false, false);
                locale.MetaKeywords    = modelMap.GetLocalized(x => x.MetaKeywords, Id, languageId, false, false);
                locale.MetaDescription = modelMap.GetLocalized(x => x.MetaDescription, Id, languageId, false, false);
                locale.SeoUrl          = modelMap.GetLocalized(x => x.SeoUrl, Id, languageId, false, false);
            });

            return(base.View(modelMap));
        }