public async Task <IHttpActionResult> Putipn(long id, ipn ipn) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ipn.id) { return(BadRequest()); } db.Entry(ipn).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ipnExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Getipn(long id) { ipn ipn = await db.Ipns.FindAsync(id); if (ipn == null) { return(NotFound()); } return(Ok(ipn)); }
public async Task <IHttpActionResult> Postipn(ipn ipn) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Ipns.Add(ipn); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = ipn.id }, ipn)); }
public async Task <IHttpActionResult> Deleteipn(long id) { ipn ipn = await db.Ipns.FindAsync(id); if (ipn == null) { return(NotFound()); } db.Ipns.Remove(ipn); await db.SaveChangesAsync(); return(Ok(ipn)); }