public async Task <IActionResult> Edit(int id, [Bind("Id,CaseId,ArticleId")] CaseArticle caseArticle)
        {
            if (id != caseArticle.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(caseArticle);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CaseArticleExists(caseArticle.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ArticleId"] = new SelectList(_context.CriminalArticles, "Id", "Info", caseArticle.ArticleId);
            ViewData["CaseId"]    = new SelectList(_context.Cases, "Id", "Info", caseArticle.CaseId);
            return(View(caseArticle));
        }
        public async Task <IActionResult> Create([Bind("Id,CaseId,ArticleId")] CaseArticle caseArticle)
        {
            int caseId = caseArticle.CaseId;

            if (ModelState.IsValid)
            {
                _context.Add(caseArticle);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", "CaseArticles", new { id = _context.Cases.Where(c => c.Id == caseId).FirstOrDefault().InvestigatorId, caseId = caseId }));
            }
            return(RedirectToAction("Index", "CaseArticles", new { id = _context.Cases.Where(c => c.Id == caseId).FirstOrDefault().InvestigatorId, caseId = caseId }));
        }