public ActionResult GenerateDispatchAllocation(int id) { try { var result = _transportOrderService.GeneratDispatchPlan(id); if (result) { return(RedirectToAction("Index", "Dispatch", new { Area = "Hub" })); } else { ModelState.AddModelError("Errors", @"Unable to generate dispatch allocation."); return(RedirectToAction("Index", "TransportOrder", new { Area = "Hub" })); } } catch (Exception ex) { var log = new Logger(); log.LogAllErrorsMesseges(ex, _log); ModelState.AddModelError("Errors", @"Unable to generate dispatch allocation."); } return(RedirectToAction("Index", "TransportOrder", new { Area = "Hub" })); }