public string UpdateElem(int id, [FromBody] PilotsDTO element)
 {
     if (!ModelState.IsValid)
     {
         return("Not valid data");
     }
     try
     {
         pilotService.Update(id, element);
         return("Updated new elemnt");
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
 public string CreateNewElem([FromBody] PilotsDTO element)
 {
     if (!ModelState.IsValid)
     {
         return("Not valid data");
     }
     try
     {
         pilotService.Create(element);
         return("Created the new element");
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
Пример #3
0
 // PUT: api/Pilots/5
 public ApiResult Put(int id, [FromBody] PilotsDTO value)
 {
     return(ServicesPilots.Update(value));
 }
Пример #4
0
 public ApiResult Post([FromBody] PilotsDTO value)
 {
     return(ServicesPilots.Insert(value));
 }