Esempio n. 1
0
        public HttpResponseMessage Detail(IdModelProceso Id)
        {
            Proceso acu = new Proceso();

            try
            {
                acu = db.Proceso.Where(x => x.IdProceso == Id.IdProceso).FirstOrDefault();
                if (acu != null)
                {
                    return new HttpResponseMessage(HttpStatusCode.OK)
                           {
                               Content = new StringContent(JsonConvert.SerializeObject(acu), System.Text.Encoding.UTF8, "application/json")
                           }
                }
                ;
                else
                {
                    return new HttpResponseMessage(System.Net.HttpStatusCode.NoContent)
                           {
                               Content = null
                           }
                };
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.InternalServerError, ex.Message + Environment.NewLine + "Area"));
            }
        }
Esempio n. 2
0
        public HttpResponseMessage Delete(IdModelProceso Id)
        {
            Proceso acu = new Proceso();

            try
            {
                acu = db.Proceso.Where(x => x.IdProceso == Id.IdProceso).FirstOrDefault();
                if (acu != null)
                {
                    acu.Activo_Inactivo = false;
                    db.SaveChanges();
                    return(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
                    {
                        Content = null
                    });
                }
                else
                {
                    return(new HttpResponseMessage(System.Net.HttpStatusCode.NoContent)
                    {
                        Content = null
                    });
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse <string>(HttpStatusCode.InternalServerError, ex.Message + Environment.NewLine + "Area"));
            }
        }