public IHttpActionResult PutLog_Update(int id, Log_Update log_Update)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public static HttpResponseMessage Apply_Log_Update(int _BStages_Updated, int _BStages_Added, int _API_call_failure)
        {
            //  update the table "Log_Update" in the company db
            Log_Update lu = new Log_Update()
            {
                id               = DateTime.Today.Day,
                DayOfMonth       = DateTime.Today.Day,
                Updated_date     = DateTime.Now,
                BStages_Updated  = _BStages_Updated,
                BStages_Added    = _BStages_Added,
                API_call_failure = _API_call_failure
            };

            HttpResponseMessage result;

            using (HttpClient client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://111.111.11.11:13/api/");
                Task <HttpResponseMessage> putTask = client.PutAsJsonAsync($"log_update/{lu.id}", lu);
                putTask.Wait();
                result = putTask.Result;
            }

            return(result);
        }
        public IHttpActionResult GetLog_Update(int id)
        {
            Log_Update log_Update = db.Log_Updates.Find(id);

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

            return(Ok(log_Update));
        }