예제 #1
0
        // POST api/CRMOriginDestination?tblOriginDestination
        public void Post([FromBody] tblOriginDestination od)
        {
            using (var ctx = new CRMModel())
            {
                var cuscon = ctx.Set <tblOriginDestination>();
                cuscon.Add(new tblOriginDestination
                {
                    CusId       = od.CusId,
                    No          = od.No,
                    Origin      = od.Origin,
                    Destination = od.Destination,
                    EmId        = od.EmId,
                    AddPerson   = od.AddPerson,
                    Department  = od.Department
                });

                ctx.SaveChanges();
            }
        }
예제 #2
0
        // PUT api/CRMOriginDestination?CusId,No,tblOrigindestination
        public void Put(String CusId, int No, [FromBody] tblOriginDestination od)
        {
            using (var ctx = new CRMModel())
            {
                // Update Statement
                var update = ctx.tblOriginDestinations.Where(ci => ci.CusId == CusId).FirstOrDefault();
                if (update != null)
                {
                    update.CusId       = od.CusId;
                    update.No          = od.No;
                    update.Origin      = od.Origin;
                    update.Destination = od.Destination;
                    update.EmId        = od.EmId;
                    update.AddPerson   = od.AddPerson;
                    update.Department  = od.Department;
                }

                ctx.SaveChanges();
            }
        }