public HttpResponseMessage EliminarPunto(PuntoModel punto)
 {
     try
     {
         var proveedor_id = HttpContext.Current.User.Identity.GetUserId();
         var _punto       = contexto.punto_exact.Where(x => x.exact_id == punto.Exact_id && x.punto_id == punto.Punto_id && x.punto.proveedor_id == proveedor_id).FirstOrDefault();
         if (_punto == null)
         {
             resp.Codigo  = (int)Codigos.REGISTRO_NO_ENCONTRADO;
             resp.Mensaje = Enum.GetName(typeof(Codigos), (int)Codigos.REGISTRO_NO_ENCONTRADO);
             return(resp.ObjectoRespuesta());
         }
         contexto.punto_exact.Remove(_punto);
         contexto.SaveChanges();
         resp.Codigo  = (int)Codigos.OK;
         resp.Mensaje = Enum.GetName(typeof(Codigos), (int)Codigos.OK);
         return(resp.ObjectoRespuesta());
     }
     catch (Exception ex)
     {
         resp.Codigo    = (int)Codigos.ERROR_DE_SERVIDOR;
         resp.Mensaje   = Enum.GetName(typeof(Codigos), (int)Codigos.ERROR_DE_SERVIDOR);
         resp.Excepcion = Excepcion.Create(ex);
         return(resp.ObjectoRespuesta());
     }
 }
Beispiel #2
0
 public HttpResponseMessage EliminarPunto([FromBody] PuntoModel punto)
 {
     return(op.EliminarPunto(punto));
 }