// Attribute specifying to routing layer that POST is intended (http verb) public ActionResult <Toaster> Create(Toaster toaster) { _toasterService.Create(toaster); // calls toasterService.Create method return(CreatedAtRoute("GetToaster", new { id = toaster.Id.ToString() }, toaster)); // sends 201 with info on new toaster in header }
public ActionResult <Toaster> Create(Toaster toaster) { _toasterService.Create(toaster); return(CreatedAtRoute("GetToaster", new { id = toaster.Id.ToString() }, toaster)); }