예제 #1
0
        public ActionResult PostEditTeamProjectSummary(TeamProjectSummaryModel parm)
        {
            using (LoveBankDBContext db = new LoveBankDBContext())
            {
                var t_s = db.T_SourceFile;
                var t_ps = db.T_TeamProjectSummary;

                TeamProjectSummary model = t_ps.Find(parm.Id);

                //model.AddTime = DateTime.Now;
                //model.AddUserId = AdminUser.ID;
                //model.State = RowState.有效;
                //model.Guid = Guid.NewGuid().ToString();
                model.SubTitle = parm.SubTitle;
                //model.TeamProjectId = parm.TeamProjectId;
                model.Desc = parm.Desc;

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

                //}

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

                //db.T_SourceFile.AddRange(parm.SourceFileList);
                //db.SaveChanges();

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

                return Success("新增成功");
            }
        }
예제 #2
0
        public ActionResult PostAddTeamProjectSummary(TeamProjectSummaryModel parm)
        {
            TeamProjectSummary model = new TeamProjectSummary();

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

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

            //}

            using (LoveBankDBContext db = new LoveBankDBContext())
            {

                db.Add<TeamProjectSummary>(model);
                db.SaveChanges();

                //db.T_SourceFile.AddRange(parm.SourceFileList);
                //db.SaveChanges();

                return Success("新增成功");
            }
        }