public ActionResult PostEdit(LBStartOrBottomAdModel parm)
        {
            using (LoveBankDBContext db = new LoveBankDBContext())
            {

                var t_m = db.T_Machine;
                var t_a = db.T_LBStartOrBottomAd;
                var t_s = db.T_SourceFile;

                #region 初始化参数
                LBStartOrBottomAd model = t_a.Find(parm.ID);

                model.Title = parm.Title;
                model.Desc = parm.Desc;
                model.LinkUrl = parm.LinkUrl;
                model.DeptId = parm.DeptId;
                model.Postion = parm.Postion;

                ///删除原来的,彻底以新增方式进行(修改通过删除在新增实现)
                var delSourceFile = from s in t_s where s.Guid == model.Guid select s;
                db.T_SourceFile.RemoveRange(delSourceFile);
                db.SaveChanges();
                #endregion

                db.Update<LBStartOrBottomAd>(model);
                db.SaveChanges();

                foreach (var item in parm.SourceFileList)
                {
                    item.Guid = model.Guid;
                    item.AddTime = DateTime.Now;
                }

                db.T_SourceFile.AddRange(parm.SourceFileList);//重新绑定
                db.SaveChanges();

                return Success("修改成功");

            }
        }
        public ActionResult PostAdd(LBStartOrBottomAdModel parm)
        {
            #region 初始化参数
            LBStartOrBottomAd model = new LBStartOrBottomAd();

            model.AddTime = DateTime.Now;
            model.AddUserId = AdminUser.ID;
            model.State = RowState.有效;
            model.Guid = Guid.NewGuid().ToString();

            model.LinkUrl = parm.LinkUrl;
            model.Title = parm.Title;
            model.Desc = parm.Desc;
            model.Postion = parm.Postion;
            model.DeptId = parm.DeptId;
            model.AddUserDeptId = AdminUser.DeptId;

            foreach (var item in parm.SourceFileList)
            {
                item.Guid = model.Guid;
                item.AddTime = DateTime.Now;

            }
            #endregion

            using (LoveBankDBContext db = new LoveBankDBContext())
            {

                db.Add(model);
                db.SaveChanges();
                db.T_SourceFile.AddRange(parm.SourceFileList);
                db.SaveChanges();

                return Success("添加成功");

            }
        }