예제 #1
0
        public async Task <ObjectResult> Post(string Nickname)
        {
            _logger.LogInformation($"Add reader: {Nickname}");
            var response = await readerService.AddReader(Nickname);

            if (response == null)
            {
                _logger.LogInformation("Internal gateway error");
                return(StatusCode(500, "Internal error"));
            }

            return(StatusCode(response.Code, response.Message));
        }
        public IActionResult AddOrEdit(ReaderViewModel readerViewModel)
        {
            if (readerViewModel.Id == Guid.Empty)
            {
                _readerService.AddReader(readerViewModel);
            }
            else
            {
                _readerService.EditReader(readerViewModel);
            }

            return(RedirectToAction("Index"));
        }