Exemple #1
0
        /// <summary>
        /// 添加菜单
        /// </summary>
        /// <param name="tMenu">菜单信息</param>
        /// <param name="operational">操作信息</param>
        /// <returns>结果</returns>
        public static Result AddMenu(TMenu tMenu, Operational operational)
        {
            Result result = new Result();

            try
            {
                using (var menuRepository = DbContext.CreateIMenuRepository())
                {
                    if (tMenu.Id == Guid.Empty)
                    {
                        tMenu.Id = Guid.NewGuid();
                    }
                    var mMenu = tMenu.ToMMenu();
                    menuRepository.Add(mMenu);
                }

                result.IsSucceed = true;
                result.Message   = "添加成功";
            }
            catch (Exception ex)
            {
                result.IsSucceed = false;
                result.Message   = Const.ErrorMessage;
                LogService.WriteLog(ex, "添加菜单");
            }
            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 修改菜单
        /// </summary>
        /// <param name="tMneu">菜单信息</param>
        /// <param name="operational">操作信息</param>
        /// <returns>结果</returns>
        public static Result UpdateMenu(TMenu tMneu, Operational operational)
        {
            Result result = new Result();

            try
            {
                using (var menuRepository = DbContext.CreateIMenuRepository())
                {
                    var mMenu = tMneu.ToMMenu();
                    menuRepository.Update(mMenu);
                }

                result.IsSucceed = true;
                result.Message   = "修改成功";
            }
            catch (Exception ex)
            {
                result.IsSucceed = false;
                result.Message   = Const.ErrorMessage;
                LogService.WriteLog(ex, "修改菜单");
            }
            return(result);
        }