Ejemplo n.º 1
0
        public ActionResult Details(string id)
        {
            ViewBag.Id = id;
            DegreeSchool Model = m_BLL.GetById(id);

            return(View(Model));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据Id获取详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetById(string id)
        {
            DegreeSchool         Model = m_BLL.GetById(id);
            JavaScriptSerializer js    = new JavaScriptSerializer();
            string jsonStr             = js.Serialize(Model);

            return(jsonStr);
        }
 /// <summary>
 /// 创建一个学历学校
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="db">数据库上下文</param>
 /// <param name="entity">一个学历学校</param>
 /// <returns></returns>
 public bool Create(ref ValidationErrors validationErrors, DegreeSchool entity)
 {
     try
     {
         repository.Create(entity);
         return(true);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="entity">实体对象</param>
        /// <returns></returns>
        public Common.ClientResult.Result Post([FromBody] DegreeSchool entity)
        {
            Common.ClientResult.Result result = new Common.ClientResult.Result();
            if (entity != null && ModelState.IsValid)
            {
                //string currentPerson = GetCurrentPerson();
                //entity.CreateTime = DateTime.Now;
                //entity.CreatePerson = currentPerson;

                entity.Id = Result.GetNewId();
                string returnValue = string.Empty;
                if (m_BLL.Create(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(Suggestion.InsertSucceed + ",学历学校的信息的Id为" + entity.Id, "学历学校"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Succeed;
                    result.Message = Suggestion.InsertSucceed;
                    return(result); //提示创建成功
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(Suggestion.InsertFail + ",学历学校的信息," + returnValue, "学历学校"
                                                   );//写入日志
                    result.Code    = Common.ClientCode.Fail;
                    result.Message = Suggestion.InsertFail + returnValue;
                    return(result); //提示插入失败
                }
            }

            result.Code    = Common.ClientCode.FindNull;
            result.Message = Suggestion.InsertFail + ",请核对输入的数据的格式"; //提示输入的数据的格式不对
            return(result);
        }
        /// <summary>
        /// 根据ID获取数据模型
        /// </summary>
        /// <param name="id">编号</param>
        /// <returns></returns>
        public DegreeSchool Get(string id)
        {
            DegreeSchool item = m_BLL.GetById(id);

            return(item);
        }