Пример #1
0
        public async Task <LogFrontend> AddAsync(LogFrontend logCreacionDto)
        {
            await _unitOfWork.LogFrontendRepository.Add(logCreacionDto);

            await _unitOfWork.SaveChangesAsync();

            return(logCreacionDto);
        }
        public async Task <IActionResult> PostLogFrontend([FromBody] LogFrontend logFrontend)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            logFrontend.UserIp          = _accessor.HttpContext?.Connection?.RemoteIpAddress?.ToString();
            logFrontend.DatetimeBackend = DateTime.Now;

            _context.LogFrontend.Add(logFrontend);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetLogFrontend", new { id = logFrontend.IdLog }, logFrontend));
        }
 public async Task <IActionResult> Post(LogFrontend log)
 => Ok(new ApiResponse <LogFrontend>(await _logService.AddAsync(log)));