Пример #1
0
        public static async Task<Responsavel> insertResponsavel(string login, string nome, string senha)
        {
            Usuario usuario = new Usuario() { Login = login, Nome = nome, Senha = senha };
            await App.MobileService.GetTable<Usuario>().InsertAsync(usuario);

            Responsavel responsavel = new Responsavel { UsuarioId = usuario.Id };
            await App.MobileService.GetTable<Responsavel>().InsertAsync(responsavel);
            return responsavel;
        }
Пример #2
0
 public static async void deleteResponsavel(Responsavel r)
 {
     try
     {
         List<ResponsavelAluno> ras = await getAllResponsavelAlunosByResponsavelId(r.Id);
         foreach (ResponsavelAluno ra in ras)
         {
             await App.MobileService.GetTable<ResponsavelAluno>().DeleteAsync(ra);
         }
         await App.MobileService.GetTable<Responsavel>().DeleteAsync(r);
         await App.MobileService.GetTable<Usuario>().DeleteAsync(new Usuario() { Id = r.Usuario.Id, Login = r.Usuario.Login, Nome = r.Usuario.Nome, Senha = r.Usuario.Senha });
     }
     catch (Exception)
     {
         await new MessageDialog("Não foi possível excluir este Responsável.").ShowAsync();
     }
 }
Пример #3
0
 public static async void updateResponsavel(Responsavel responsavel, Usuario usuario)
 {
     await App.MobileService.GetTable<Usuario>().UpdateAsync(usuario);
     //responsavel.Usuario = null;
     //await App.MobileService.GetTable<Responsavel>().UpdateAsync(responsavel);
 }