public void DeleteComentario(int id) { var context = new ArticuloDbContext(); Comentario Model = context.Comentarios.Find(id); context.Comentarios.Remove(Model); context.SaveChanges(); }
public void Delete(int Id) { var context = new ArticuloDbContext(); Articulo Model = context.Articulos.Find(Id); context.Articulos.Remove(Model); context.SaveChanges(); }
public Comentario Details(int Id) { Comentario result = null; var context = new ArticuloDbContext(); result = (from c in context.Comentarios where c.Id == Id select c).FirstOrDefault(); return result; }
public void EditComentario(Comentario Model) { var context = new ArticuloDbContext(); context.Entry(Model).State = EntityState.Modified; context.SaveChanges(); }
public void CreateComentario(Entities.Comentario Model) { var context = new ArticuloDbContext(); context.Comentarios.Add(Model); context.SaveChanges(); }
public void Create(Entities.Articulo Model) { var context = new ArticuloDbContext(); context.Articulos.Add(Model); context.SaveChanges(); }
public Entities.Articulo GetOne(int Id) { Entities.Articulo result = null; var context = new ArticuloDbContext(); result = (from c in context.Articulos.Include("Comentarios") where c.Id == Id select c).FirstOrDefault(); //using (var con = new SqlConnection(this.ConnectionString)) //{ // result = con.Query<Entities.Articulo>("usp_articulos_get_one", // new {Id = Id}, // commandType: System.Data.CommandType.StoredProcedure).FirstOrDefault(); //} return result; }