Пример #1
0
        public HttpResponseMessage Detail(IdModelSubProceso Id)
        {
            SubProceso acu = new SubProceso();

            try
            {
                acu = db.SubProceso.Where(x => x.IdSubProceso == Id.IdSubProceso).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"));
            }
        }
Пример #2
0
        public HttpResponseMessage Delete(IdModelSubProceso Id)
        {
            SubProceso acu = new SubProceso();

            try
            {
                acu = db.SubProceso.Where(x => x.IdSubProceso == Id.IdSubProceso).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"));
            }
        }