예제 #1
0
        // 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
        }
예제 #2
0
        public ActionResult <Toaster> Create(Toaster toaster)
        {
            _toasterService.Create(toaster);

            return(CreatedAtRoute("GetToaster", new { id = toaster.Id.ToString() }, toaster));
        }