Example #1
0
        public IHttpActionResult PutServiciosEmpresa(int id, ServiciosEmpresa serviciosEmpresa)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #2
0
 private void inicializarServicios()
 {
     try
     {
         serviciosViewempresa = (ServiciosViewempresa)Configurador.ConfigurarServicio(typeof(ServiciosViewempresa));
         serviciosViewempresa.AutenticacionValue = new WS_ServiciosViewempresa.Autenticacion()
         {
             usuario = "U", contrasena = "1"
         };
         serviciosEmpresa = (ServiciosEmpresa)Configurador.ConfigurarServicio(typeof(ServiciosEmpresa));
         serviciosEmpresa.AutenticacionValue = new WS_ServiciosEmpresa.Autenticacion()
         {
             usuario = "U", contrasena = "1"
         };
         serviciosImagen = (ServiciosImagen)Configurador.ConfigurarServicio(typeof(ServiciosImagen));
         serviciosImagen.AutenticacionValue = new WS_ServiciosImagen.Autenticacion()
         {
             usuario = "U", contrasena = "1"
         };
     }
     catch (Exception exp)
     {
         Controles.mensajes.mensajeError(exp.Message);
     }
 }
Example #3
0
        public IHttpActionResult GetServiciosEmpresa(int id)
        {
            ServiciosEmpresa serviciosEmpresa = db.ServiciosEmpresa.Find(id);

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

            return(Ok(serviciosEmpresa));
        }
Example #4
0
        public async Task <IHttpActionResult> GetServiciosEmpresa(int id)
        {
            ServiciosEmpresa serviciosEmpresa = await db.ServiciosEmpresa.FindAsync(id);

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

            return(Ok(serviciosEmpresa));
        }
Example #5
0
        public IHttpActionResult PostServiciosEmpresa(ServiciosEmpresa serviciosEmpresa)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ServiciosEmpresa.Add(serviciosEmpresa);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = serviciosEmpresa.Id_ServicioEmpresa }, serviciosEmpresa));
        }
Example #6
0
 private void InicializarServicios()
 {
     serviciosEmpresa = (ServiciosEmpresa)Configurador.ConfigurarServicio(typeof(ServiciosEmpresa));
     serviciosEmpresa.AutenticacionValue = new WS_ServiciosEmpresa.Autenticacion()
     {
         usuario = "U", contrasena = "1"
     };
     serviciosImagen = (ServiciosImagen)Configurador.ConfigurarServicio(typeof(ServiciosImagen));
     serviciosImagen.AutenticacionValue = new WS_ServiciosImagen.Autenticacion()
     {
         usuario = "U", contrasena = "1"
     };
 }
Example #7
0
        public IHttpActionResult DeleteServiciosEmpresa(int id)
        {
            ServiciosEmpresa serviciosEmpresa = db.ServiciosEmpresa.Find(id);

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

            db.ServiciosEmpresa.Remove(serviciosEmpresa);
            db.SaveChanges();

            return(Ok(serviciosEmpresa));
        }
Example #8
0
        public async Task <IHttpActionResult> DeleteServiciosEmpresa(int id)
        {
            ServiciosEmpresa serviciosEmpresa = await db.ServiciosEmpresa.FindAsync(id);

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

            db.ServiciosEmpresa.Remove(serviciosEmpresa);
            await db.SaveChangesAsync();

            return(Ok(serviciosEmpresa));
        }