0
I can’t call the methods: DeleteOnSubmit
and also the method: DeleteObject
. See below my code and how I delete it.
public static void deletaRuptura(int _idmotivo)
{
RupturaEntities db = new RupturaEntities();
try
{
var monta_arvore = (from rup in db.Ruptura
join ap in db.Apresentacao on rup.Codigo_Apresentacao equals (ap.Codigo_Apresentacao)
join mo in db.Motivo on rup.IDMotivo equals (mo.IDMotivo)
join pdv in db.PDV on rup.CodigoPDV equals (pdv.CodigoPDV)
where rup.IDMotivo != _idmotivo
//group rup by new { rup.IDRuptura} into gr
select new
{
rup.IDRuptura,
rup.DataRuptura,
rup.IDMotivo,
rup.Motivo.Motivo1,
rup.IDOrigem,
rup.CodigoPDV,
rup.PDV.UF,
pdv.Cidade,
CnpjDescricao = pdv.Cnpj + " - " + pdv.Descricao,
rup.Codigo_Apresentacao,
ap.Unidade_Negocio,
ap.Codigo_Unidade_Negocio,
ap.Franquia,
ap.Familia,
ap.Descricao
}).ToList().OrderBy(r => r.IDMotivo);
foreach (var item in monta_arvore)
{
//db.DeleteOnSubmit(item);
}
}
catch (Exception ex)
{
}
}
That’s the mistake that comes:
'System.Data.Entity.DbSet<Ruptura.Models.Ruptura>' does not contain a definition for 'DeleteAllOnSubmit' and no extension method 'DeleteAllOnSubmit' accepting a first argument of type 'System.Data.Entity.DbSet<Ruptura.Models.Ruptura>' could be found (are you missing a using directive or an assembly reference?)
can edit your question with the db.Deleteonsubmit(item) method? This is where the exception is raised?
– Vinícius