コード例 #1
0
        public async Task <PPEvent> Create(PPEventCreate create)
        {
            var ppEvent = PPEvent.FromCreate(create);
            await _ppEvents.InsertOneAsync(ppEvent);

            return(ppEvent);
        }
コード例 #2
0
        public async Task <ActionResult <PPEvent> > Create([FromHeader] string authToken, PPEventCreate create)
        {
            if (!await _authenticationService.CheckAccess(authToken, "ppEventMgr"))
            {
                return(Unauthorized());
            }

            PPEvent created = await _ppEventService.Create(create);

            await _logService.Create(new Log(
                                         null,
                                         AuthenticationHelpers.GetUserIdFromToken(authToken),
                                         DateTime.UtcNow,
                                         "Document created.",
                                         "pp.events",
                                         created.Id,
                                         JsonSerializer.Serialize(created)
                                         ));

            return(Ok(create));
        }