Example #1
0
        /// <summary>
        /// 编辑内容
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public IActionResult LearningInfoEdit(LearningInfoModel model)
        {
            LearningInfoModel vmodel = new LearningInfoModel();
            string            id     = GetParameterViewBag("id");

            if (!string.IsNullOrEmpty(id))
            {
                var info = _learningService.SingleInfo(id);
                vmodel = _learningService.ConverToInfoModel(info);
            }

            View(vmodel);


            if (Post)
            {
                model.SetBase(HttpContext);

                if (string.IsNullOrEmpty(id))
                {
                    var result = _learningService.AddInfo(model);
                }
                else
                {
                    var result = _learningService.UpdateInfo(model);
                }

                return(RedirectToAction("LearningInfoList", "Learning"));
            }

            return(View());
        }