Beispiel #1
0
        public async Task <IActionResult> PutRoomImageInfo(RoomImageInfo roomImageInfo)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    roomImageInfo.Ip = Request.HttpContext.Connection.RemoteIpAddress.ToString();

                    await _roomImageInfoService.CreateRoomImageInfoAsync(roomImageInfo);

                    return(Ok());
                }
            }
            catch (Exception ex)
            {
                _logger.LogException(ex);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }

            return(BadRequest());
        }
Beispiel #2
0
        public async Task CreateAsync(RoomImageInfo roomImageInfo)
        {
            DateTime dateNow   = DateTime.UtcNow;
            long     timestamp = new DateTimeOffset(dateNow).ToUnixTimeMilliseconds();
            DateTime dayDate   = dateNow.Date;

            int?projectEntryId = null;
            int?dayEntryId     = null;

            projectEntryId = await GetProjectEntryIdFromCache(roomImageInfo.ProjectId, roomImageInfo.CustomerId);

            if (projectEntryId != null)
            {
                dayEntryId = await GetDayEntryIdFromCache(projectEntryId, dayDate);

                if (dayEntryId != null)
                {
                    int?timestampEntryId = await InsertTimeStampEntry(dayEntryId, timestamp);
                    await InsertRequestDetailsEntry(timestampEntryId, roomImageInfo.Ip, roomImageInfo.UserAgent, roomImageInfo.RequestString);
                }
            }
        }
Beispiel #3
0
 public async Task CreateRoomImageInfoAsync(RoomImageInfo roomImageInfo)
 {
     await _roomImageInfoRepository.CreateAsync(roomImageInfo);
 }