コード例 #1
0
        public ActionResult Create(YiDuiDuoZhongDeDuo entity)
        {
            if (entity != null && ModelState.IsValid)
            {
                //string currentPerson = GetCurrentPerson();
                //entity.CreateTime = DateTime.Now;
                //entity.CreatePerson = currentPerson;


                string returnValue = string.Empty;
                if (m_BLL.Create(ref validationErrors, entity))
                {
                    LogClassModels.WriteServiceLog(LogType.Operation, Suggestion.InsertSucceed + ",一对多中的多的信息的Id为" + entity.Id, "一对多中的多",
                                                   Result.Succeed);//写入日志
                    return(Json(Suggestion.InsertSucceed));
                }
                else
                {
                    if (validationErrors != null && validationErrors.Count > 0)
                    {
                        validationErrors.All(a =>
                        {
                            returnValue += a.ErrorMessage;
                            return(true);
                        });
                    }
                    LogClassModels.WriteServiceLog(LogType.Operation, Suggestion.InsertFail + ",一对多中的多的信息," + returnValue, "一对多中的多",
                                                   Result.Fail);       //写入日志
                    return(Json(Suggestion.InsertFail + returnValue)); //提示插入失败
                }
            }

            return(Json(Suggestion.InsertFail + ",请核对输入的数据的格式")); //提示输入的数据的格式不对
        }
コード例 #2
0
 /// <summary>
 /// 创建一个一对多中的多
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="db">数据库上下文</param>
 /// <param name="entity">一个一对多中的多</param>
 /// <returns></returns>
 public bool Create(ref ValidationErrors validationErrors, YiDuiDuoZhongDeDuo entity)
 {
     try
     {
         return(repository.Create(entity) == 1);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
コード例 #3
0
 /// <summary>
 /// 编辑一个一对多中的多
 /// </summary>
 /// <param name="validationErrors">返回的错误信息</param>
 /// <param name="entity">一个一对多中的多</param>
 /// <returns></returns>
 public bool Edit(ref ValidationErrors validationErrors, YiDuiDuoZhongDeDuo entity)
 {
     try
     {
         repository.Edit(db, entity);
         return(repository.Save(db) == 1);
     }
     catch (Exception ex)
     {
         validationErrors.Add(ex.Message);
         ExceptionsHander.WriteExceptions(ex);
     }
     return(false);
 }
コード例 #4
0
        public ActionResult Details(int id)
        {
            YiDuiDuoZhongDeDuo item = m_BLL.GetById(id);

            return(View(item));
        }