public async Task <ActionResult <Counsellors> > PostCounsellors(Counsellors counsellors) { _context.Counsellors.Add(counsellors); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCounsellors", new { id = counsellors.Id }, counsellors)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Rank,Group,GroupSize")] Counsellors counsellors) { if (id != counsellors.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(counsellors); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CounsellorsExists(counsellors.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(counsellors)); }
public async Task <IActionResult> PutCounsellors(int id, Counsellors counsellors) { if (id != counsellors.Id) { return(BadRequest()); } _context.Entry(counsellors).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CounsellorsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Create([Bind("Id,Name,Rank,Group,GroupSize")] Counsellors counsellors) { if (ModelState.IsValid) { _context.Add(counsellors); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(counsellors)); }