public IHttpActionResult GetIPAddress(int id) { ClientIP.Models.IPAddress iPAddress = db.IPAddresses.Find(id); if (iPAddress == null) { return(NotFound()); } return(Ok(iPAddress)); }
public IHttpActionResult PostIPAddress(ClientIP.Models.IPAddress iPAddress) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.IPAddresses.Add(iPAddress); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = iPAddress.Id }, iPAddress)); }
public IHttpActionResult DeleteIPAddress(int id) { ClientIP.Models.IPAddress iPAddress = db.IPAddresses.Find(id); if (iPAddress == null) { return(NotFound()); } db.IPAddresses.Remove(iPAddress); db.SaveChanges(); return(Ok(iPAddress)); }