Example #1
0
        /// <summary>
        /// 增加
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <Result <SecondLevel> > addSecondLevelDir(SecondLevelDirModel model, string userName)
        {
            SecondLevel data = new SecondLevel
            {
                createdBy    = userName,
                firstLevelId = model.firstLevelID,
                open         = model.open,
                title        = model.title,
                url          = model.url,
                orderId      = model.orderId
            };

            return(await dao.addSecondLevelDir(data));
        }
Example #2
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <Result <SecondLevel> > updateSecondLevelDir(SecondLevelDirModel model, string userName)
        {
            SecondLevel data = new SecondLevel
            {
                id              = model.id,
                lastUpdatedBy   = userName,
                lastUpdatedDate = DateTime.Now,
                firstLevelId    = model.firstLevelID,
                open            = model.open,
                title           = model.title,
                url             = model.url,
                orderId         = model.orderId
            };

            return(await dao.updateSecondLevelDir(data));
        }
Example #3
0
        public async Task <ActionResult> Update(SecondLevelDirModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await layer.updateSecondLevelDir(model, User.Identity.Name);

                if (result.success)
                {
                    ViewBag.ReturnUrl = "/SecondLevelDir/Update?id=" + model.id;
                    return(View("Success"));
                }
                else
                {
                    ModelState.AddModelError("", result.message);
                }
            }
            return(View());
        }