Exemple #1
0
 public IHttpActionResult Post(Maintenance maintenance)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     maintenanceLogic.Insert(maintenance);
     return(CreatedAtRoute("DefaultApi", new { id = 100 }, maintenance));
 }
        public IHttpActionResult Maintenance(Maintenance workID, [FromBody] Maintenance maintenance)
        {
            if (workID == null || workID.Equals(0))
            {
                return(BadRequest());
            }

            else
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            maintenanceLogic.Insert(maintenance);
            return(StatusCode(HttpStatusCode.NoContent));
        }