コード例 #1
0
        public static bool DeleteAllAllowedInvoiceAndLines()
        {
            try
            {
                using (var ctx = new SuchDBContext())
                {
                    List <AutorizarFaturaçãoContratos> all = GetAll();
                    foreach (var item in all)
                    {
                        if (item.NãoFaturar != true)
                        {
                            ctx.Remove(item);
                        }

                        List <LinhasFaturaçãoContrato> lines = DBInvoiceContractLines.GetById(item.NºContrato);
                        foreach (var line in lines)
                        {
                            DBInvoiceContractLines.DeleteById(line);
                        }
                    }
                    ctx.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
コード例 #2
0
        public static bool Delete(PerfisModelo ProfileModelToDelete)
        {
            try
            {
                using (var ctx = new SuchDBContext())
                {
                    DBUserProfiles.DeleteAllFromProfile(ProfileModelToDelete.Id);
                    ctx.Remove(ProfileModelToDelete);
                    ctx.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }