示例#1
0
        public async Task <TalkVm> AddTalkAsync(TalkVm talk)
        {
            var result = await _talkService.AddTalkAsync(talk).ConfigureAwait(false);

            _cache.Remove(nameof(GetAllTalksAsync));

            return(result);
        }
示例#2
0
        public async Task <IActionResult> AddTalk([FromBody] TalkDTO talkDTO)
        {
            try
            {
                if (talkDTO == null)
                {
                    return(BadRequest(new ApiResponse {
                        Status = false, Message = "Bad Request"
                    }));
                }

                await _talkService.AddTalkAsync(talkDTO);
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.Message, $"Failed to add Talk: {DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff")}");
            }
            _logger.LogInformation("Successfully added Talk");
            return(Created("", new ApiResponse {
                Status = true, Message = "Successful"
            }));
        }
示例#3
0
 public Task <TalkVm> AddTalk([FromBody] TalkVm talk)
 => _talkService.AddTalkAsync(talk);