Exemplo n.º 1
0
        public vwleakageTown GetvwleakageTown(int id)
        {
            vwleakageTown vwleakageTown = db.vwleakageTowns.Find(id);

            if (vwleakageTown == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(vwleakageTown);
        }
Exemplo n.º 2
0
        public HttpResponseMessage PutvwleakageTown(int id, vwleakageTown vwleakageTown)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            if (id != vwleakageTown.id)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            try
            {
                db.Entry(vwleakageTown).State = EntityState.Modified;
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, ex));
            }

            return(Request.CreateResponse(HttpStatusCode.OK));
        }