Beispiel #1
0
 public HttpResponseMessage AddProject([FromBody] Project value)
 {
     //curl -v -X POST -H "Content-type: application/json" -d "{\"Name\":\"tr1\", \"Customer\":\"nnn\",\"TeamLeaderId\":\"21\" , \"DevelopHours\":\"300\",\"QAHours\":\"250\", \"UiUxHours\":\"100\",\"StartDate\":\"2018-02-02\",\"EndDate\":\"2018-07-07\"}"  http://localhost:59628/api/addProject
     if (ModelState.IsValid)
     {
         return((ManagerLogic.AddProject(value)) ?
                new HttpResponseMessage(HttpStatusCode.Created) :
                new HttpResponseMessage(HttpStatusCode.BadRequest)
         {
             Content = new ObjectContent <String>("Can not add to DB", new JsonMediaTypeFormatter())
         });
     }
     return(Global.ErrorList(ModelState));
 }
 public HttpResponseMessage AddProject([FromBody] Project value)
 {
     if (ModelState.IsValid)
     {
         return((ManagerLogic.AddProject(value)) ?
                new HttpResponseMessage(HttpStatusCode.Created)
         {
             Content = new ObjectContent <bool>(true, new JsonMediaTypeFormatter())
         } :
                new HttpResponseMessage(HttpStatusCode.BadRequest)
         {
             Content = new ObjectContent <String>("Can not add to DB", new JsonMediaTypeFormatter())
         });
     }
     return(Global.ErrorList(ModelState));
 }