public async Task <IActionResult> PutAcEventLog([FromRoute] int id, [FromBody] AcEventLog acEventLog)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != acEventLog.EvlId)
            {
                return(BadRequest());
            }

            _context.Entry(acEventLog).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AcEventLogExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PostAcEventLog([FromBody] AcEventLog acEventLog)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.AcEventLog.Add(acEventLog);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAcEventLog", new { id = acEventLog.EvlId }, acEventLog));
        }
Ejemplo n.º 3
0
        /* public static LoggerService Instance
         * {
         *   get
         *   {
         *       if (_logger == null)
         *       {
         *           _logger = new LoggerService();
         *
         *       }
         *
         *       return _logger;
         *   }
         * }*/

        public void InsertEventLog(string value, int trtId, int?objId, int evsId)
        {
            AcEventLog eventLog = new AcEventLog
            {
                EvlDate     = DateTime.Now,
                EvlTrgValue = value,
                EvlTrtId    = trtId,
                EvlObjId    = objId,
                EvlEvsId    = evsId
            };

            _context.AcEventLog.Add(eventLog);
            _context.SaveChanges();
        }