コード例 #1
0
        // POST api/CRMPs?tblPS
        public void Post([FromBody] tblP PS)
        {
            using (var ctx = new CRMModel())
            {
                var cuscon = ctx.Set <tblP>();
                cuscon.Add(new tblP
                {
                    CusID     = PS.CusID,
                    PSRefNo   = PS.PSRefNo,
                    PSubID    = PS.PSubID,
                    Plot      = PS.Plot,
                    Isudt     = PS.Isudt,
                    MoveDate  = PS.MoveDate,
                    PSId      = PS.PSId,
                    ProjectID = PS.ProjectID,
                    ExPDate   = PS.ExPDate
                });

                ctx.SaveChanges();
            }
        }
コード例 #2
0
        // PUT api/CRMPs?CusId,tblPS
        public void Put(String CusId, [FromBody] tblP PS)
        {
            using (var ctx = new CRMModel())
            {
                // Update Statement
                var update = ctx.tblPS.Where(ci => ci.CusID == CusId).FirstOrDefault();
                if (update != null)
                {
                    update.CusID     = PS.CusID;
                    update.PSRefNo   = PS.PSRefNo;
                    update.PSubID    = PS.PSubID;
                    update.Plot      = PS.Plot;
                    update.Isudt     = PS.Isudt;
                    update.MoveDate  = PS.MoveDate;
                    update.PSId      = PS.PSId;
                    update.ProjectID = PS.ProjectID;
                    update.ExPDate   = PS.ExPDate;
                }

                ctx.SaveChanges();
            }
        }