public async Task <IActionResult> Edit(int id, [Bind("Id,Name,CultureId,DiseaseId")] DiseaseTraslation diseaseTraslation) { if (id != diseaseTraslation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(diseaseTraslation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DiseaseTraslationExists(diseaseTraslation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index), "Diseases")); } ViewData["CultureId"] = new SelectList(_context.Culture, "Id", "Name", diseaseTraslation.CultureId); ViewData["DiseaseId"] = new SelectList(_context.Disease, "Id", "Name", diseaseTraslation.DiseaseId); ViewData["DiseaseIdSingle"] = diseaseTraslation.DiseaseId; return(View(diseaseTraslation)); }
public async Task <IActionResult> Create(DiseaseTraslation diseaseTraslation) { if (ModelState.IsValid) { _context.Add(diseaseTraslation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index), "Diseases")); } ViewData["CultureId"] = new SelectList(_context.Culture, "Id", "Name", diseaseTraslation.CultureId); ViewData["DiseaseId"] = new SelectList(_context.Disease, "Id", "Name", diseaseTraslation.DiseaseId); ViewData["DiseaseIdSingle"] = diseaseTraslation.DiseaseId; return(View(diseaseTraslation)); }