예제 #1
0
        /// <summary>
        /// 保存技术问答评论
        /// </summary>
        /// <param name="data"></param>
        public void SaveAnswerComment(List <EduAnswerEntity> data, EduBaseInfoEntity entity)
        {
            IRepository db = new RepositoryFactory().BaseRepository().BeginTrans();

            var oldEntity = db.FindEntity <EduBaseInfoEntity>(entity.ID);
            var list      = db.FindList <EduAnswerEntity>(x => x.EduId == entity.ID).ToList();

            oldEntity.Teacher          = entity.Teacher;
            oldEntity.TeacherId        = entity.TeacherId;
            oldEntity.RegisterPeople   = entity.RegisterPeople;
            oldEntity.RegisterPeopleId = entity.RegisterPeopleId;
            oldEntity.Theme            = entity.Theme;
            oldEntity.RunWay           = entity.RunWay;
            oldEntity.Answers          = null;
            oldEntity.Files            = null;

            //遍历
            foreach (var item in list)
            {
                var newItem = data.Where(s => s.ID == item.ID).FirstOrDefault();
                if (newItem != null)
                {
                    if (string.IsNullOrEmpty(newItem.Grade))
                    {
                        item.Grade = "0";
                    }
                    else
                    {
                        item.Grade = newItem.Grade;
                    }
                    item.AppraiseContent = newItem.AppraiseContent;
                    item.Files           = null;
                }
            }

            try
            {
                db.Update(list);
                db.Update(oldEntity);
                db.Commit();
            }
            catch
            {
                db.Rollback();
            }
        }
예제 #2
0
 public void Add(EduBaseInfoEntity entity)
 {
     baseService.Add(entity);
 }
예제 #3
0
 public void EditEducation(EduBaseInfoEntity data)
 {
     baseService.EditEducation(data);
 }
예제 #4
0
 public void UdateAnswerComment(List <EduAnswerEntity> data, EduBaseInfoEntity entity)
 {
     answerService.SaveAnswerComment(data, entity);
 }
예제 #5
0
 public void updataEduBaseInfo(EduBaseInfoEntity entity)
 {
     baseService.update(entity);
 }
예제 #6
0
        //public DataTable GetEducationPageList(Pagination pagination, string queryJson)
        //{
        //    return baseService.GetEducationPageList(pagination, queryJson);
        //}

        public void SaveEduBaseInfo(string id, EduBaseInfoEntity entity)
        {
            baseService.SaveForm(id, entity);
        }
예제 #7
0
 public void Modify(EduBaseInfoEntity entity)
 {
     baseService.Modify(entity);
 }