示例#1
0
 public int PutParksWagons(int id, [FromBody] ParksWagons value)
 {
     try
     {
         this.ef_park.Update(value);
         return(this.ef_park.Save());
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
示例#2
0
 public int PostParksWagons([FromBody] ParksWagons value)
 {
     try
     {
         this.ef_park.Add(value);
         this.ef_park.Save();
         this.ef_park.Refresh(value);
         return(value.id);
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
示例#3
0
 public IHttpActionResult GetParksWagons(int id)
 {
     try
     {
         ParksWagons wagon = this.ef_park
                             .Context
                             .Where(w => w.id == id)
                             .ToList()
                             .Select(p => new ParksWagons
         {
             id           = p.id,
             name_park_ru = p.name_park_ru,
             name_park_en = p.name_park_en
         }).FirstOrDefault();
         return(Ok(wagon));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }