public HttpResponseMessage deleteTarifa(DeleteTarifaRequest delTarifa) { var TarifaDA = new TarifaDataAccess(); var TarifaEliminada = TarifaDA.DeleteTarifa(delTarifa); return(Request.CreateResponse(HttpStatusCode.OK, TarifaEliminada)); }
//MÉTODO DE BORRAR TARIFA public DeleteTarifaResponse DeleteTarifa(DeleteTarifaRequest delTarifa) { try { using (var context = new BDReservasEntities()) { ObjectParameter RETCODE = new ObjectParameter("RETCODE", typeof(int)); ObjectParameter MENSAJE = new ObjectParameter("MENSAJE", typeof(string)); context.PA_DELETE_TARIFA(delTarifa.Id_tarifa, RETCODE, MENSAJE); if ((int)RETCODE.Value < 0) { throw new Exception("Error no controlado"); } if ((int)RETCODE.Value > 0) { throw new Exception(MENSAJE.Value.ToString().Trim()); } return(new DeleteTarifaResponse() { Retcode = (int)RETCODE.Value, Mensaje = MENSAJE.Value.ToString().Trim() }); } } catch (Exception ex) { return(new DeleteTarifaResponse() { Mensaje = ex.Message, Retcode = -1 }); } }