Ejemplo n.º 1
0
        public IHttpActionResult PutPatrol_Log(int id, Patrol_Log patrol_Log)
        {
            db.Configuration.ProxyCreationEnabled = false;
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != patrol_Log.Patrol_Log_ID)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetPatrol_Log(int id)
        {
            db.Configuration.ProxyCreationEnabled = false;
            Patrol_Log patrol_Log = db.Patrol_Log.Find(id);

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

            return(Ok(patrol_Log));
        }
Ejemplo n.º 3
0
        public IHttpActionResult PostPatrol_Log(Patrol_Log patrol_Log)
        {
            db.Configuration.ProxyCreationEnabled = false;
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Patrol_Log.Add(patrol_Log);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = patrol_Log.Patrol_Log_ID }, patrol_Log));
        }
Ejemplo n.º 4
0
        public IHttpActionResult DeletePatrol_Log(int id)
        {
            db.Configuration.ProxyCreationEnabled = false;
            Patrol_Log patrol_Log = db.Patrol_Log.Find(id);

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

            db.Patrol_Log.Remove(patrol_Log);
            db.SaveChanges();

            return(Ok(patrol_Log));
        }