public async Task <IActionResult> Create([Bind("Id,Code,Name")] ExamSite examSite) { if (ModelState.IsValid) { await _examSiteService.SaveExamSite(examSite); return(RedirectToAction(nameof(Index))); } return(View(examSite)); }
public async Task <bool> UpdateExamSite(ExamSite examSite) { try { _context.Update(examSite); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ExamSiteExists(examSite.Id)) { return(false); } else { throw; } } return(true); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Code,Name")] ExamSite examSite) { if (id != examSite.Id) { return(NotFound()); } if (ModelState.IsValid) { if (await _examSiteService.UpdateExamSite(examSite)) { return(RedirectToAction(nameof(Index))); } else { return(NotFound()); } } return(View(examSite)); }
public async Task SaveExamSite(ExamSite examSite) { _context.Add(examSite); await _context.SaveChangesAsync(); }