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