public IActionResult AddEditPost(int?id) { PostViewModel model = new PostViewModel(); try { var post = _repository.GetPostById(id); if (id.HasValue) { model = _mapper.Map <Post, PostViewModel>(post); } // ViewBag.ProcessName = _repository.GetAllControlTools(); return(PartialView("~/Areas/Transit/Views/Transit/AddEditPost.cshtml", model)); } catch (Exception ex) { return(BadRequest("Failed to get orders")); } }