예제 #1
0
        public async Task <IActionResult> RaiseTicket(TicketVM model)
        {
            bool _checkSession = CheckSession();

            if (_checkSession)
            {
                return(RedirectToAction(nameof(Logout)));
            }
            try
            {
                if (ModelState.IsValid)
                {
                    var result = await _ticket.RaiseTicket(model);

                    if (result != null)
                    {
                        _logger.LogInformation($"ticket raised successfully....");
                        TempData["msg"] = $"Ticket created successfully";
                    }
                    else
                    {
                        _logger.LogInformation($"could not raise ticket....");
                    }
                }
                else
                {
                    _logger.LogInformation($"Invalid model state....", model.clients);
                    ViewBag.msg = $"Please fill out all fields";
                }
            }
            catch (Exception ex)
            {
                _logger.LogError($"{ex?.InnerException?.InnerException?.Message}");
            }
            return(RedirectToAction(nameof(Index)));
        }