My code only lists what the database has at the moment, but I need to insert data into it.
namespace WebApplication5.Controllers
{
public class DefaultController : ApiController
{
public IEnumerable<Table_1> Get()
{
using (testEntities entities = new testEntities())
{
Table_1 us = new Table_1() { id = "221", name = "asdsadasdsad" };
entities.Table_1.Add(us);
entities.SaveChangesAsync();
return entities.Table_1.ToList();
}
}
}
}
normally db updates with that query
Insert into Table_1 values ('111','222')
id (string)
name(string)