public async Task <ActionResult <Lecionar> > Create([FromBody] Lecionar lecionar) { if (ModelState.IsValid) { _context.Lecionar.Add(lecionar); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(lecionar); }
public async Task <ActionResult <Lecionar> > Edit([FromBody] Lecionar lecionar) { if (ModelState.IsValid) { try { _context.Update(lecionar); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { return(NotFound()); } return(RedirectToAction(nameof(Index))); } return(lecionar); }