コード例 #1
0
        public ActionResult CreateEdit(long Id = 0)
        {
            NeNews item = new NeNews();

            ViewBag.CategoryList = _neCategoryService.LoadAll(true);

            if (Id > 0)
            {
                item = _neNewsService.Get(Id);
            }
            else
            {
                NeNewsDetails _itemDetails = new NeNewsDetails();
                _itemDetails.Language = GlobalContext.WebSite.Language;
                item.Details.Add(_itemDetails);
            }

            if (GlobalContext.WebSite.IsMultiLangual)
            {
                foreach (var lang in SupportedCultures.Cultures)
                {
                    var count = item.Details.Where(x => x.Language == lang.TwoLetterISOLanguageName).Count();
                    if (count <= 0)
                    {
                        NeNewsDetails _itemDetails = new NeNewsDetails();
                        _itemDetails.Language = lang.TwoLetterISOLanguageName;
                        item.Details.Add(_itemDetails);
                    }
                }
            }
            return(View(item));
        }
コード例 #2
0
        public ActionResult CreateEdit(long Id = 0)
        {
            NeNews item = new NeNews();

            ViewBag.CategoryList = _neCategoryService.LoadAll(true);

            if (Id > 0)
            {
                item = _neNewsService.Get(Id);
            }
            return(View(item));
        }