// =============================================== Repositório abaixo public async Task <Heroi> Create(Heroi heroi) { _context.Herois.Add(heroi); await _context.SaveChangesAsync(); return(heroi); }
public ActionResult InsertHero(string nameHero) { try { var heroi = new Heroi { Nome = nameHero }; _context.Herois.Add(heroi); _context.SaveChangesAsync(); return(Ok()); } catch (Exception ex) { return(Ok()); } }
/// <summary> /// /// </summary> /// <returns></returns> /// <remarks></remarks> public async Task <bool> SaveChangeAsync() { return((await _context.SaveChangesAsync()) > 0); }
public async Task InsertAsync(Heroi heroi) { _context.Add(heroi); await _context.SaveChangesAsync(); }