예제 #1
0
        public async Task <IActionResult> Checkout(string id, [FromBody] Search search)
        {
            IListModelResponse <entity.Visitor> response = new ListModelResponse <entity.Visitor>();

            try
            {
                _logger.LogInformation(entities.LoggingEvents.InsertItem, "Visitor Checkout, id:{0}", id);
                await _visitorRepository.CheckOut(id);

                response.Model = await _visitorRepository.GetVisitors(search);

                response.Message = "Visitor checked out";
            }
            catch (Exception ex)
            {
                _logger.LogInformation(entities.LoggingEvents.InsertItem, "Visitor Checkout, Exception:{0}", ex);
                response.IsError      = true;
                response.ErrorMessage = "Could not checkout Visitor";

                return(BadRequest(response));
            }

            return(Ok(response));
        }