public void Post(suspencione susp) { if (ModelState.IsValid) { myEntity.suspenciones.Add(susp); myEntity.SaveChanges(); } }
public void Put(suspencione susp) { if (ModelState.IsValid) { myEntity.Entry(susp).State = EntityState.Modified; try { myEntity.SaveChanges(); } catch (Exception) { throw; } } }
public void Delete(int id) { suspencione dlt = myEntity.suspenciones.Find(id); if (dlt != null) { try { myEntity.suspenciones.Remove(dlt); myEntity.SaveChanges(); } catch (Exception) { throw; } } }
public suspencione Get(int id) { suspencione susp = myEntity.suspenciones.Find(id); return(susp); }