コード例 #1
0
        /// <summary>
        /// 更新导师信息
        /// </summary>
        /// <returns></returns>
        public ActionResult UpdateLecture(Lecturer lecture)
        {
            ICollection <Author> authorlist = (ICollection <Author>)Session["authorlist"];

            Author author = authorlist.FirstOrDefault(x => x.ControllerName == "Lecturer" && x.ActionName == "UpdateLecture");
            JsonResultData <string> resultdata = new JsonResultData <string>();

            if (author != null)
            {
                try
                {
                    int result = lectureservice.UpdateLecturer(lecture);


                    if (result == 0)
                    {
                        resultdata.Code = 0;
                        resultdata.Data = "编辑失败";
                    }
                    else
                    {
                        resultdata.Code = 1;
                        resultdata.Data = "编辑成功";
                    }
                }
                catch (Exception ex)
                {
                    resultdata.Msg = ex.Message;
                }
            }
            else
            {
                resultdata.Code = 2;
                resultdata.Data = "没有权限";
            }
            return(Json(resultdata, JsonRequestBehavior.AllowGet));
        }