public HttpResponseMessage UpdateStartHour([FromBody] JObject data)
 {
     if (ModelState.IsValid)
     {
         bool   isFirst = (bool)data["isFirst"];
         string s       = (string)data["hour"];
         return((isFirst ? WorkerLogic.UpdateStartHour((int)data["idProjectWorker"], Convert.ToDateTime(s))
             : WorkerLogic.UpdateEndHour((int)data["idProjectWorker"], Convert.ToDateTime(s))) ?
                new HttpResponseMessage(HttpStatusCode.OK) :
                new HttpResponseMessage(HttpStatusCode.BadRequest)
         {
             Content = new ObjectContent <String>("Can not update in DB", new JsonMediaTypeFormatter())
         });
     }
     ;
     return(Global.ErrorList(ModelState));
 }
예제 #2
0
 public HttpResponseMessage UpdateStartHour([FromBody] JObject data)
 {
     //curl -v -X PUT -H "Content-type: application/json" -d "{\"Id\":\"7\",\"hour\":\"8\"}"  http://localhost:59628/api/updateHours
     if (ModelState.IsValid)
     {
         bool   isFirst = (bool)data["isFirst"];
         string s       = (string)data["hour"];
         return((isFirst ? WorkerLogic.UpdateStartHour((int)data["idProjectWorker"], Convert.ToDateTime(s))
             : WorkerLogic.UpdateEndHour((int)data["idProjectWorker"], Convert.ToDateTime(s))) ?
                new HttpResponseMessage(HttpStatusCode.OK) :
                new HttpResponseMessage(HttpStatusCode.BadRequest)
         {
             Content = new ObjectContent <String>("Can not update in DB", new JsonMediaTypeFormatter())
         });
     }
     ;
     return(Global.ErrorList(ModelState));
 }