public IHttpActionResult AddChuanJia(AddChuanJiaModel model)
        {
            var chuanJia = new Zs_ChuanJia();
            var result = new ChuanJiaViewModel();

            //初始化实体
            chuanJia = sysFun.InitialEntity<AddChuanJiaModel, Zs_ChuanJia>(model, chuanJia);
            //添加传家有道
            chuanJia = bChuanJia.Add(chuanJia);
            //更新附件列表
            result = UpdateAttList(chuanJia);

            if (chuanJia.CJID > 0)
            {
                return Ok(result);
            }
            else
            {
                return Ok("添加失败");
            }
        }
        /// <summary>
        /// 更新附件列表
        /// </summary>
        /// <param name="chuanjia">传家信息</param>
        private ChuanJiaViewModel UpdateAttList(Zs_ChuanJia chuanjia)
        {
            var result = new ChuanJiaViewModel();

            //实体列表
            var chuanJiaAttList = bChuanJiaAtt.Entities.Where(f => f.CreateDate < chuanjia.UpdateDate && f.CJID == 0);
            //遍历删除本地资源
            foreach (var item in chuanJiaAttList) sysFun.DeleteFile(item.AttType, item.AttUrl);
            //批量删除
            if (chuanJiaAttList.Count() > 0) bChuanJiaAtt.Delete(chuanJiaAttList);
            //批量更新
            bChuanJiaAtt.Update(f => f.MID == chuanjia.MID, f => new Zs_ChuanJiaAtt { CJID = chuanjia.CJID });
            //实体列表
            chuanJiaAttList = bChuanJiaAtt.Entities.Where(f => f.MID == chuanjia.MID);

            result.ChuanJia = chuanjia;
            result.ChuanJiaAtt = chuanJiaAttList.ToList();
            return result;
        }
        public IHttpActionResult UpdateChuanJia(UpdateChuanJiaModel model)
        {
            var chuanJia = new Zs_ChuanJia();
            var result = new ChuanJiaViewModel();

            //初始化实体
            chuanJia = bChuanJia.Find(model.CJID);
            chuanJia = sysFun.InitialEntity<UpdateChuanJiaModel, Zs_ChuanJia>(model, chuanJia);
            //更新传家有道
            chuanJia = bChuanJia.UpdateEntity(chuanJia);
            //更新附件列表
            result = UpdateAttList(chuanJia);

            return Ok(result);
        }