示例#1
0
        // GET: Articles/Edit/5
        public async Task <IActionResult> Edit(Guid?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var article = await _articleCategoryService.GetArticleForEditByIdAsync(id.Value);

            if (article == null)
            {
                return(NotFound());
            }
            var categoryIds = _articleCategoryService.GetAllCategoryNameValue().Result;

            ViewData["Categorys"] = new MultiSelectList(categoryIds, "Value", "Name", categoryIds.Where(c => article.CatetoryIds.Contains(c.Value)).ToList());
            return(View(Mapper.Map <CreateOrUpdateArticleViewDto>(article)));
        }