Exemple #1
0
 public static async Task <bool> SaveAsync(Orcamento orcamento, string token)
 {
     if (await SegurancaServ.validaTokenAsync(token))
     {
         if (orcamento.idCliente != 0)
         {
             if (orcamento.ID == 0)
             {
                 Orcamentorep rep = new Orcamentorep();
                 try { rep.Add(orcamento); return(true); } catch (Exception e) { return(false); }
             }
             else
             {
                 Orcamentorep rep = new Orcamentorep();
                 try { rep.Update(orcamento); return(true); } catch (Exception e) { return(false); }
             }
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Exemple #2
0
 public static async Task <List <Orcamento> > GetListAsync(int idCliente, string token)
 {
     if (await SegurancaServ.validaTokenAsync(token))
     {
         Orcamentorep rep = new Orcamentorep();
         return(rep.GetAll().Where(x => x.idCliente == idCliente).ToList());
     }
     else
     {
         return(new List <Orcamento>());
     }
 }