public async Task <Response> Insert(ProfessorViewModelsAdapter Enviar, ProfessorViewModelsAdapter DaseDados) { using (AppProfessorContext context = new AppProfessorContext()) { using (Transation_Scoper db = new Transation_Scoper(context)) { // Verificando na Dase de Dados foreach (var itemEnviar in Enviar.Disciplina) { foreach (var itemBase in DaseDados.Disciplina) { if (itemEnviar.Designacao.ToUpper() == itemBase.Designacao.ToUpper()) { db.DoUpdate <DisciplinaViewModels>(itemBase); } else { db.DoInsert <DisciplinaViewModels>(itemBase); } } } // Verificando Inversa Enviar / Base de Dados foreach (var itemBase in DaseDados.Disciplina) { foreach (var itemEnviar in Enviar.Disciplina) { if (itemEnviar.Designacao.ToUpper() == itemBase.Designacao.ToUpper()) { db.DoUpdate <DisciplinaViewModels>(itemBase); } else { db.DoInsert <DisciplinaViewModels>(itemBase); } } } //var result = await db.DoSincronizar<ProfessorViewModelsAdapter>(x =>x.ProfessorID, Enviar, DaseDados).EndTransaction(); return(new Response { //IsSucess = result.estado, //list = models, //Messgems = result.Exception, }); } } }
public async Task <Response> Delete(int alunos) { using (AppProfessorContext context = new AppProfessorContext()) { using (Transation_Scoper db = new Transation_Scoper(context)) { var result = await db.DoDelete <Macs>(alunos).EndTransaction(); return(new Response { IsSucess = result.estado, list = alunos, Messgems = result.Exception, }); } } }
public async Task <Response> Update(List <Macs> models) { using (AppProfessorContext context = new AppProfessorContext()) { using (Transation_Scoper db = new Transation_Scoper(context)) { var result = await db.DoUpdateRange(models).EndTransaction(); return(new Response { IsSucess = result.estado, list = models, Messgems = result.Exception, }); } } }
public async Task <Response> Insert(Logs usuarios) { using (AppProfessorContext context = new AppProfessorContext()) { using (Transation_Scoper db = new Transation_Scoper(context)) { var result = await db.DoInsert(usuarios).EndTransaction(); return(new Response { IsSucess = result.estado, list = usuarios, Messgems = result.Exception, }); } } }
public async Task <Response> Update(FaltasLogs faltasLogs) { using (AppProfessorContext context = new AppProfessorContext()) { using (Transation_Scoper db = new Transation_Scoper(context)) { var result = await db.DoUpdate <FaltasLogs>(faltasLogs).EndTransaction(); return(new Response { IsSucess = result.estado, list = faltasLogs, Messgems = result.Exception, }); } } }
public async Task <Response> Insert(Professor_Disciplina models) { using (AppProfessorContext context = new AppProfessorContext()) { using (Transation_Scoper db = new Transation_Scoper(context)) { var result = await db.DoInsert <Professor_Disciplina>(models).EndTransaction(); return(new Response { IsSucess = result.estado, list = models, Messgems = result.Exception, }); } } }
public async Task <Response> Update(Escola escola) { using (AppProfessorContext context = new AppProfessorContext()) { using (Transation_Scoper db = new Transation_Scoper(context)) { var result = await db.DoUpdate <Escola>(escola).EndTransaction(); return(new Response { IsSucess = result.estado, list = escola, Messgems = result.Exception, }); } } }
public async Task <Response> Insert(ProfessorViewModelsAdapter models) { using (AppProfessorContext context = new AppProfessorContext()) { using (Transation_Scoper db = new Transation_Scoper(context)) { var result = await db.DoInsertIfNotExists(x => x.ProfessorDisciplinaID, models).EndTransaction(); return(new Response { IsSucess = result.estado, list = models, Messgems = result.Exception, }); } } }