public async Task <IActionResult> Edit(string id, [Bind("Id,Name,DrugUrl,Biomarker")] AnnotatedDrug annotatedDrug) { if (id != annotatedDrug.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(annotatedDrug); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AnnotatedDrugExists(annotatedDrug.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(annotatedDrug)); }
public async Task <IActionResult> Create([Bind("Id,Name,DrugUrl,Biomarker")] AnnotatedDrug annotatedDrug) { if (ModelState.IsValid) { _context.Add(annotatedDrug); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(annotatedDrug)); }