コード例 #1
0
        //[HttpPost]
        public IHttpActionResult UpdateApi(APIemp em)
        {
            Step2017Entities2 en = new Step2017Entities2();

            en.Entry(em).State = EntityState.Modified;
            en.SaveChanges();
            return(Ok());
        }
コード例 #2
0
        public IHttpActionResult PostApi(APIemp em)
        {
            Step2017Entities2 en = new Step2017Entities2();

            en.APIemps.Add(em);
            en.SaveChanges();
            return(Ok());
        }
コード例 #3
0
        public IHttpActionResult DeleteApi(int id)
        {
            Step2017Entities2 en = new Step2017Entities2();
            APIemp            em = new APIemp();
            var id1 = en.APIemps.Where(c => c.id == id).FirstOrDefault();

            en.APIemps.Remove(id1);
            en.SaveChanges();
            return(Ok());
        }