SHARE
TWEET

Untitled

a guest Feb 15th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Model
  2. {
  3.         public int WeekID { get; set; }
  4. }
  5.    
  6. [HttpPost]
  7. public IHttpActionResult AddHour(Hour hour)
  8. {      
  9.      return Ok();
  10. }
  11.    
  12. export const SaveWeek s= weekData=> {
  13.   const headers = new Headers();
  14.   headers.append("Content-Type", "application/json");
  15.  
  16.   const Week= {
  17.     method: "POST",
  18.     headers,
  19.     mode: "cors",
  20.     body: weekData
  21.   };
  22.  
  23.   console.log("Hours:");
  24.  
  25.   // Returns {"WeekID": 1}
  26.   console.log(Hours.body);
  27.  
  28.   return axios.post("http://localhost:52350/api/REST/AddHour", {
  29.     Week
  30.   });
  31. };
  32.    
  33. [HttpPost]
  34.  public IHttpActionResult AddHour(Hour hour)
  35.  {
  36.    // This returns a string in which the data that I sent
  37.    // can be found.
  38.     string body = Request.Content.ReadAsStringAsync().Result;
  39.  
  40.      return Ok();
  41.  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top