public IHttpActionResult GetCardsWagonsRepairs(int id) { try { CardsWagonsRepairs repairs = this.ef_cwr.Context .Where(w => w.id == id) .ToList() .Select(c => new CardsWagonsRepairs { id = c.id, num = c.num, id_type_repair_wagon = c.id_type_repair_wagon, date_repair = c.date_repair, id_internal_railroad = c.id_internal_railroad, code_depo = c.code_depo, date_non_working = c.date_non_working, id_wagons_condition = c.id_wagons_condition, note = c.note, create = c.create, create_user = c.create_user, change = c.change, change_user = c.change_user, }).FirstOrDefault(); return(Ok(repairs)); } catch (Exception e) { return(BadRequest(e.Message)); } }
public int PutCardsWagonsRepairs(int id, [FromBody] CardsWagonsRepairs value) { try { this.ef_cwr.Update(value); return(this.ef_cwr.Save()); } catch (Exception e) { return(-1); } }
public int PostCardsWagonsRepairs([FromBody] CardsWagonsRepairs value) { try { this.ef_cwr.Add(value); return(this.ef_cwr.Save()); //this.ef_cards.Refresh(value); //return value.num; } catch (Exception e) { return(-1); } }