Exemplo n.º 1
0
 public async Task <IEnumerable <Arquivo> > GetArquivo(int idcliente, int idArquivo, string token)
 {
     if (await Seguranca.validaTokenAsync(token))
     {
         return(ArquivoDAO.GetAll().Where(x => x.idCliente == idcliente && x.ID == idArquivo).ToList());
     }
     else
     {
         return(new List <Arquivo>());
     }
 }
Exemplo n.º 2
0
        public async Task <JsonResult> DeletarArquivo([FromBody] object Arquivo, string token)
        {
            dynamic objEn = Arquivo;
            string  a     = objEn.idArquivo.ToString();

            if (await Seguranca.validaTokenAsync(token))
            {
                Arquivo obj = ArquivoDAO.GetAll().Where(x => x.ID == Convert.ToInt32(a)).FirstOrDefault();
                return(Json(new { msg = ArquivoDAO.Remove(obj) }));
                //return Json(new { msg = false });
            }
            else
            {
                return(Json(new { msg = false }));
            }
        }