예제 #1
0
        public async Task <SystemEventDto> CreateSystemEventAsync(SystemEventDto dto)
        {
            var document = DtoToDocument <SystemEventDto, SystemEvent>(dto);

            document.Id = MongoHelper.GenerateId();

            document.CreateAt = DateTime.UtcNow;

            await Context.SystemEventRepository.InsertOneAsync(document);

            return(DocumentToDto <SystemEvent, SystemEventDto>(document));
        }
예제 #2
0
        public async Task <SystemEventDto> AddSystemEventAsync(SystemEventDto dto)
        {
            HttpResponseMessage response = await _proxyService.PostJsonAsync("/api/systemevents", new
            {
                machineName = dto.MachineName,
                machineId   = dto.MachineId,
                description = dto.Description,
                action      = dto.Action,
                status      = dto.Status
            });

            response.EnsureSuccessStatusCode();

            return(await response.Content.ReadAsAsync <SystemEventDto>());
        }
예제 #3
0
 public async Task <IHttpActionResult> Post(SystemEventDto dto)
 {
     return(Ok(await _mongoService.CreateSystemEventAsync(dto)));
 }