コード例 #1
0
        public IHttpActionResult PutPropertyTaskHeader(int id, PropertyTaskHeader propertyTaskHeader)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            db.Entry(propertyTaskHeader).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PropertyTaskHeaderExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public IHttpActionResult GetPropertyTaskHeader(int id)
        {
            PropertyTaskHeader propertyTaskHeader = db.PropertyTaskHeaders.Find(id);

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

            return(Ok(propertyTaskHeader));
        }
コード例 #3
0
        public IHttpActionResult PostPropertyTaskHeader(PropertyTaskHeader propertyTaskHeader)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.PropertyTaskHeaders.Add(propertyTaskHeader);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = propertyTaskHeader.Id }, propertyTaskHeader));
        }
コード例 #4
0
        public IHttpActionResult DeletePropertyTaskHeader(int id)
        {
            PropertyTaskHeader propertyTaskHeader = db.PropertyTaskHeaders.Find(id);

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

            db.PropertyTaskHeaders.Remove(propertyTaskHeader);
            db.SaveChanges();

            return(Ok(propertyTaskHeader));
        }