public ActionResult Get(string heroName) { //var heroi = new Heroi { Nome = heroName }; var heroi = _context.Herois.Where(h => h.Id == 3).FirstOrDefault(); heroi.Nome = heroName; //_context.Herois.Add(heroi); _context.SaveChanges(); return(Ok()); }
public ActionResult Post(Heroi model) { try { _context.Herois.Add(model); _context.SaveChanges(); return(Ok("Funcionando")); } catch (Exception e) { return(BadRequest("Erro: " + e.Message)); } }