示例#1
0
 public string PutUser(int id, [FromBody] udata u)
 {
     try
     {
         db.Entry(u).State = EntityState.Modified;
         db.SaveChanges();
         return("done");
     }
     catch (Exception ee)
     {
         return("error");
     }
 }
示例#2
0
 public string PostUser([FromBody] udata u)
 {
     try
     {
         db.udatas.Add(u);
         db.SaveChanges();
         return("done");
     }
     catch (Exception ee)
     {
         return("error");
     }
 }
示例#3
0
 public string DeleteUser(int id)
 {
     try
     {
         udata u = db.udatas.Find(id);
         db.udatas.Remove(u);
         db.SaveChanges();
         return("done");
     }
     catch (Exception ee)
     {
         return("error");
     }
 }
示例#4
0
 public HttpResponseMessage Put(int id, [FromBody] udata value)
 {
     UserDB.Entry(value).State = EntityState.Modified;
     return(ToJson(UserDB.SaveChanges()));
 }
示例#5
0
 public HttpResponseMessage Post([FromBody] udata value)
 {
     UserDB.udatas.Add(value);
     return(ToJson(UserDB.SaveChanges()));
 }