예제 #1
0
 public ActionResult Post([FromBody] store store)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     db.stores.Add(store);
     db.SaveChanges();
     return(CreatedAtAction("Post", store));
 }
예제 #2
0
 public ActionResult Post([FromBody] item item)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     db.items.Add(item);
     db.SaveChanges();
     return(CreatedAtAction("Post", item));
 }