public static void insereCategoria(Categoria nova) { ReclamePOAContext _db = new ReclamePOAContext(); _db.Categorias.Add(nova); _db.SaveChanges(); }
public static void insereReclamacao(Reclamacao nova) { ReclamePOAContext _db = new ReclamePOAContext(); _db.Reclamacaos.Add(nova); _db.SaveChanges(); }
public static Categoria getCategoriaById(int cod) { ReclamePOAContext _db = new ReclamePOAContext(); var result = (from c in _db.Categorias where c.CategoriaId == cod select c).FirstOrDefault(); return(result); }
public static List<Comentario> getComentariosById(int cod) { ReclamePOAContext _db = new ReclamePOAContext(); List<Comentario> d = (from c in _db.Comentarios where c.ReclamacaoID == cod select c).ToList(); return d.ToList(); }
public static Categoria getCategoriaById(int cod) { ReclamePOAContext _db = new ReclamePOAContext(); var result = (from c in _db.Categorias where c.CategoriaId == cod select c).FirstOrDefault(); return result; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { gvCategorias.DataSource = Repositorio.getCategorias(); ReclamePOAContext _db = new ReclamePOAContext(); gvCategorias.DataSource = _db.Categorias.ToList(); gvCategorias.DataBind(); } }
protected void cmdInserir_Click(object sender, EventArgs e) { Categoria nova = new Categoria { Nome = txtNome.Text, Descricao = txtDescricao.Text }; ReclamePOAContext _db = new ReclamePOAContext(); _db.Categorias.Add(nova); _db.SaveChanges(); Response.Redirect("Categorias.aspx"); }
public static List <Categoria> getCategorias() { ReclamePOAContext _db = new ReclamePOAContext(); return(_db.Categorias.ToList()); }
public static List <Reclamacao> getReclamacoes() { ReclamePOAContext _db = new ReclamePOAContext(); return(_db.Reclamacaos.ToList()); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ReclamePOAContext _db = new ReclamePOAContext(); ddlCategoria.DataSource = _db.Categorias.ToList(); ddlCategoria.DataTextField = "Nome"; ddlCategoria.DataValueField = "CategoriaId"; ddlCategoria.DataBind(); GridView1.DataSource = _db.Reclamacaos.ToList(); GridView1.AutoGenerateSelectButton=true; GridView1.DataBind(); } }
public static void insereComentario(Comentario novo) { ReclamePOAContext _db = new ReclamePOAContext(); _db.Comentarios.Add(novo); _db.SaveChanges(); }
public static List<Reclamacao> getReclamacoes() { ReclamePOAContext _db = new ReclamePOAContext(); return _db.Reclamacaos.ToList(); }
public static List<Categoria> getCategorias() { ReclamePOAContext _db = new ReclamePOAContext(); return _db.Categorias.ToList(); }