public int PutParksWagons(int id, [FromBody] ParksWagons value) { try { this.ef_park.Update(value); return(this.ef_park.Save()); } catch (Exception e) { return(-1); } }
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); } }
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)); } }