Ejemplo n.º 1
0
        public async Task <ActionResult <ReceiveDataLogEntitie> > SetLog(int id)
        {
            string conString = configuration
                               .GetConnectionString("DefaultNoSQLConnection");

            var logModel = new ReceiveDataLogEntitie()
            {
                IdClient   = id,
                Json       = id.ToString(),
                Data       = DateTime.Now,
                Exception  = new Exception("Teste").ToString(),
                MethodName = "SetLog"
            };

            await reciveDataBussinessLogs.Save(logModel);

            return(logModel);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <string> > SaveUser(User user)
        {
            try
            {
                return(JsonConvert.SerializeObject(await reciveDataService.SaveUser(user)));
            }
            catch (Exception ex)
            {
                var logModel = new ReceiveDataLogEntitie()
                {
                    IdClient   = user.Id,
                    Json       = JsonConvert.SerializeObject(user),
                    Data       = DateTime.Now,
                    Exception  = ex.ToString(),
                    MethodName = "SaveUser"
                };

                await reciveDataBussinessLogs.Save(logModel);

                throw ex;
            }
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <string> > SaveItem(IEnumerable <Item> itensList)
        {
            try
            {
                await reciveDataService.SaveItem(itensList);
            }
            catch (Exception ex)
            {
                var logModel = new ReceiveDataLogEntitie()
                {
                    IdClient   = itensList.FirstOrDefault().Id,
                    Json       = JsonConvert.SerializeObject(itensList),
                    Data       = DateTime.Now,
                    Exception  = ex.ToString(),
                    MethodName = "SaveItem"
                };

                await reciveDataBussinessLogs.Save(logModel);

                throw ex;
            }
            return("done !");
        }
 public async Task Save(ReceiveDataLogEntitie log)
 {
     await _reciveDataRepositoryLogs.SaveAsync(log);
 }
        private async Task SaveMongoDB(ReceiveDataLogEntitie log)
        {
            var conexaoBiblioteca = new ConnectionMongoDB(configuration);

            await conexaoBiblioteca.ReciveDataLog.InsertOneAsync(log);
        }
 public async Task SaveAsync(ReceiveDataLogEntitie log)
 {
     await SaveMongoDB(log);
 }