private QtMenuModel InitQtMenuModel(int?id) { QtMenuModel model; if (id >= 0) { ViewBag.Mode = Constants.Mode.Edit; var result = _menuBusiness.GetAllMenuById(id.Value); Mapper.Initialize(cfg => { cfg.CreateMap <DM_MENU, QtMenuModel>(); }); model = Mapper.Map <QtMenuModel>(result.Data); } else { model = new QtMenuModel { ID = -1 }; ViewBag.Mode = Common.Constants.Mode.Add; } model.ListMenuParent = _menuBusiness.GetAllMenu().Data; return(model); }