Exemplo n.º 1
0
        public HttpResponseMessage DeleteDetailJob(IdModelGuiaServicioModelDetails id)
        {
            DetalleGuiaServiciosPuesto guia = new DetalleGuiaServiciosPuesto();

            try
            {
                if (id != null)
                {
                    guia = db.DetalleGuiaServiciosPuesto.Where(x => x.IdDetalleGuiaServiciosPuesto == id.IdGuiaServicioDetailJob).FirstOrDefault();

                    if (guia != null)
                    {
                        db.DetalleGuiaServiciosPuesto.Remove(guia);
                    }
                    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 + "Guia de Servicio"));
            }
        }
Exemplo n.º 2
0
        public HttpResponseMessage EditDetailJob(DetalleGuiaServicioPuestoModel guiam)
        {
            DetalleGuiaServiciosPuesto detalleGuiaServiciosPuesto = new DetalleGuiaServiciosPuesto();

            try
            {
                if (guiam != null)
                {
                    detalleGuiaServiciosPuesto = db.DetalleGuiaServiciosPuesto.Where(x => x.IdDetalleGuiaServiciosPuesto == guiam.IdDetalleGuiaServiciosPuesto).FirstOrDefault();

                    detalleGuiaServiciosPuesto.IdGuiaServicio        = guiam.IdGuiaServicio;
                    detalleGuiaServiciosPuesto.IdDetalleGuiaServicio = guiam.IdDetalleGuiaServicio;
                    detalleGuiaServiciosPuesto.IdPuesto = guiam.IdPuesto;
                    detalleGuiaServiciosPuesto.Cantidad = guiam.Cantidad;
                    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 + "Guia de Servicio"));
            }
        }