Пример #1
0
        public IHttpActionResult GetIPAddress(int id)
        {
            IIPAddressBS bs = DIFactoryDesigntime.GetInstance <IIPAddressBS>();

            PingCo.Model.IPAddress IPAddress = bs.GetIPAddressesById(id);

            if (IPAddress == null)
            {
                return(NotFound());
            }

            return(Ok(IPAddress));
        }
Пример #2
0
        public IHttpActionResult PostIPAddress(PingCo.Model.IPAddress IPAddress)
        {
            ModelState.Remove("IPAddress.Id");

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            IIPAddressBS bs = DIFactoryDesigntime.GetInstance <IIPAddressBS>();

            bs.AddIPAddresses(IPAddress);

            return(CreatedAtRoute("DefaultApi", new { id = IPAddress.Id }, IPAddress));
        }
Пример #3
0
        public IHttpActionResult PutIPAddress(int id, PingCo.Model.IPAddress IPAddress)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != IPAddress.Id)
            {
                return(BadRequest());
            }

            IIPAddressBS bs = DIFactoryDesigntime.GetInstance <IIPAddressBS>();

            bs.UpdateIPAddresses(IPAddress);


            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #4
0
        //GET: api/IPAddresss
        public IQueryable <PingCo.Model.IPAddress> GetIPAddresses()
        {
            IIPAddressBS bs = DIFactoryDesigntime.GetInstance <IIPAddressBS>();

            return(bs.GetIPAddresses());
        }