示例#1
0
        public override async Task DeleteAsync(Atendimento atendimento, object databaseContext = null)
        {
            using (var context = (databaseContext == null) ? DatabaseContext.GetContext(dbPath) : (DatabaseContext)databaseContext)
            {
                var servicosDAL = new AtendimentoItemDAL(atendimento, dbPath);
                var fotosDAL    = new AtendimentoFotoDAL(atendimento, dbPath);

                context.AtendimentoItens.RemoveRange(await servicosDAL.GetAllAsync());
                context.AtendimentoFotos.RemoveRange(await fotosDAL.GetAllAsync());
                await base.DeleteAsync(atendimento, context);
            }
        }
示例#2
0
        public async Task EliminarAtendimentoAsync(Atendimento atendimento)
        {
            var fotosDAL = new AtendimentoFotoDAL(atendimento, DependencyService.Get <IDBPath>().GetDbPath());
            var fotos    = await fotosDAL.GetAllAsync();

            await atendimentoDAL.DeleteAsync(atendimento);

            foreach (var foto in fotos)
            {
                File.Delete(DependencyService.Get <IFotoLoadMediaPlugin>().GetPathToPhoto(foto.CaminhoFoto));
            }

            Atendimentos.Remove(atendimento);
        }